Design 47 H1: test that a module entering the graph watches its siblings' alike branch

Review round 2. The siblings watched main, which is also the default
branch, so no test held the alike rule; they now watch stable and the
entering module is asserted to watch it.

Builds: design 47 H H-A-265, H-A-266
This commit is contained in:
2026-11-21 13:20:54 +01:00
parent 3160bb1fb8
commit 0de195c5aa
@@ -77,9 +77,9 @@ func TestAModuleEnteringTheTrunkGraphIsRegistered(t *testing.T) {
other := steps
other.Lint = "optional"
held := []meshcatalog.Registration{
{Module: "core", Origin: "novox/c", Path: "go/core/module.json", Branches: []string{"main"}, Policy: meshcatalog.Policy{Steps: steps,
{Module: "core", Origin: "novox/c", Path: "go/core/module.json", Branches: []string{"stable"}, Policy: meshcatalog.Policy{Steps: steps,
Artifacts: map[string]meshcatalog.StepStatuses{"lib": {Integration: "bypass"}, "files": {Lint: "bypass", Unit: "bypass"}}}},
{Module: "tools", Origin: "novox/c", Path: "go/tools/module.json", Branches: []string{"main"}, Policy: meshcatalog.Policy{Steps: steps,
{Module: "tools", Origin: "novox/c", Path: "go/tools/module.json", Branches: []string{"stable"}, Policy: meshcatalog.Policy{Steps: steps,
Artifacts: map[string]meshcatalog.StepStatuses{"lib": {Integration: "bypass"}, "files": {Unit: "bypass"}}}},
{Module: "x1", Origin: "novox/mixed", Path: "x1/module.json", Branches: []string{"main"}, Policy: meshcatalog.Policy{Steps: steps}},
{Module: "x2", Origin: "novox/mixed", Path: "x2/module.json", Branches: []string{"beta"}, Policy: meshcatalog.Policy{Steps: other}},
@@ -112,8 +112,8 @@ func TestAModuleEnteringTheTrunkGraphIsRegistered(t *testing.T) {
return r
}
lib2 := got("lib2")
if lib2.Version != 1 || lib2.Origin != "novox/c" || lib2.Path != "go/lib2/module.json" || !slices.Equal(lib2.Branches, []string{TrunkBranch}) {
t.Errorf("lib2 registered as %+v, want version 1 from novox/c, go/lib2/module.json, watching main", lib2)
if lib2.Version != 1 || lib2.Origin != "novox/c" || lib2.Path != "go/lib2/module.json" || !slices.Equal(lib2.Branches, []string{"stable"}) {
t.Errorf("lib2 registered as %+v, want version 1 from novox/c, go/lib2/module.json, watching stable, the branch its siblings watch first alike (H-A-266), not its default branch main", lib2)
}
if lib2.Policy.Steps != steps {
t.Errorf("lib2's steps %+v, want its repository's modules' alike steps %+v (H-A-263)", lib2.Policy.Steps, steps)