Fold the composer key's versions test into the existing key test: mesh-sdk is over its test budget (issue 1921)
mesh/delivery merged: source.main moved to novox/mesh-sdk@a0e5530aef1b
mesh/delivery-group group fix/1921-zero-version-builds merged: every member is merged
mesh/check being carried to 0fbc4ce6f816 on a0e5530aef1b | from 5a38a1221659, mesh-catalog bc4d43b508cf, mesh-delivery cd01f1c196d8

Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
This commit is contained in:
2026-11-06 01:59:46 +01:00
parent db4eff3885
commit 0fbc4ce6f8
+13 -19
View File
@@ -56,25 +56,7 @@ func TestAComposeAskIsRefusedWhereItDoesNotBelong(t *testing.T) {
} }
} }
// 1921: the asked versions are in the key, in any order of naming; none gives the key without them. // 1622/AC3, 1921: a composer is kept under one key per repository, commit, directory, package, toolchain and asked versions, so two asks of
func TestAComposerKeyCoversTheAskedVersions(t *testing.T) {
tc := ToolchainUsed{Version: "go1.26.0", Recipe: "3"}
a, b := strings.Repeat("a", 40), strings.Repeat("b", 40)
v1 := PackageVersions{"m/x": a, "m/y": b}
v2 := PackageVersions{"m/x": b, "m/y": a}
k1 := ComposerKey("r", askCommit, "go", "p", tc, v1)
if k1 != ComposerKey("r", askCommit, "go", "p", tc, PackageVersions{"m/y": b, "m/x": a}) {
t.Error("the key depends on the order of the versions")
}
if k1 == ComposerKey("r", askCommit, "go", "p", tc, v2) || k1 == ComposerKey("r", askCommit, "go", "p", tc, nil) {
t.Error("other versions, or none, share the key")
}
if ComposerKey("r", askCommit, "go", "p", tc, nil) != ComposerKey("r", askCommit, "go", "p", tc, PackageVersions{}) {
t.Error("an empty ask changed the key")
}
}
// 1622/AC3: a composer is kept under one key per repository, commit, directory, package and toolchain, so two asks of
// one head build it once on a node, and another head or toolchain builds its own. // one head build it once on a node, and another head or toolchain builds its own.
func TestAComposerIsKeptByWhatItWasBuiltFrom(t *testing.T) { func TestAComposerIsKeptByWhatItWasBuiltFrom(t *testing.T) {
tc := ToolchainUsed{Version: "go1.26.0", Recipe: "3"} tc := ToolchainUsed{Version: "go1.26.0", Recipe: "3"}
@@ -92,4 +74,16 @@ func TestAComposerIsKeptByWhatItWasBuiltFrom(t *testing.T) {
t.Errorf("two composers built from different inputs share the key %s", k) t.Errorf("two composers built from different inputs share the key %s", k)
} }
} }
// 1921: the asked versions are in the key, in any order of naming; none, or an empty ask, gives the key without them.
a, b := strings.Repeat("a", 40), strings.Repeat("b", 40)
k1 := ComposerKey("r", askCommit, "go", "p", tc, PackageVersions{"m/x": a, "m/y": b})
if k1 != ComposerKey("r", askCommit, "go", "p", tc, PackageVersions{"m/y": b, "m/x": a}) {
t.Error("the key depends on the order of the versions")
}
if k1 == ComposerKey("r", askCommit, "go", "p", tc, PackageVersions{"m/x": b, "m/y": a}) || k1 == ComposerKey("r", askCommit, "go", "p", tc, nil) {
t.Error("other versions, or none, share the key")
}
if ComposerKey("r", askCommit, "go", "p", tc, nil) != ComposerKey("r", askCommit, "go", "p", tc, PackageVersions{}) {
t.Error("an empty ask changed the key")
}
} }