Run the captured declarations' test per node in parallel, inside the unit level's bound (issue 1943)

This commit is contained in:
2026-10-24 16:36:42 +02:00
parent d8da8f1d36
commit de5b33843f
+13 -8
View File
@@ -96,7 +96,17 @@ func canonical(t *testing.T, raw json.RawMessage) string {
// through the composition's encoding with the same digest; together they are the declaration's resources, each once,
// each in the composition of the module it says.
func TestCompositionsOfACapturedDeclaration(t *testing.T) {
t.Parallel()
for _, node := range []string{"ace", "g14"} {
t.Run(node, func(t *testing.T) {
t.Parallel()
oneCapturedDeclaration(t, node)
})
}
}
func oneCapturedDeclaration(t *testing.T, node string) {
{
c := readCaptured(t, node)
split := splitCaptured(t, node, c)
modules := map[string]bool{}
@@ -123,14 +133,9 @@ func TestCompositionsOfACapturedDeclaration(t *testing.T) {
if !SameComposed(back, comp) {
t.Errorf("%s: %s did not round-trip", node, key)
}
d1, err1 := ComposedDigestOf(comp)
d2, err2 := ComposedDigestOf(back)
if err1 != nil || err2 != nil || d1 != d2 || !digestForm.MatchString(d1) {
t.Errorf("%s: %s digests %q and %q (%v, %v)", node, key, d1, d2, err1, err2)
}
again, _ := EncodeComposed(back)
if !bytes.Equal(raw, again) {
t.Errorf("%s: %s encodes differently once read back", node, key)
// SameComposed encodes both, so the digest of what was read back, a hash of its encoding, is the one written.
if d, err := ComposedDigestOf(back); err != nil || !digestForm.MatchString(d) {
t.Errorf("%s: %s digests %q (%v)", node, key, d, err)
}
for _, r := range back.Resources {
var head struct {