diff --git a/modules/mesh-delivery-builder/buildrun/choose_test.go b/modules/mesh-delivery-builder/buildrun/choose_test.go index 705a878a..a6325ea5 100644 --- a/modules/mesh-delivery-builder/buildrun/choose_test.go +++ b/modules/mesh-delivery-builder/buildrun/choose_test.go @@ -20,7 +20,7 @@ func tcs(language, version string, nodes ...string) []buildstep.NodeToolchain { } func chooseTakesTheAgreedNodesWithFewestRunningStepsTiesByName(t *testing.T) { // 1607/AC4, ADR 0478 clause 3 - entries := tcs("go", "go1.27.1", "novox", "ace", "g14", "shanks") + entries := tcs("go", "go1.27", "novox", "ace", "g14", "shanks") nodes, tc, err := ChooseNodes("go", entries, placesRunning(map[string]int{"novox": 3, "ace": 1, "g14": 1, "shanks": 0}), nil, 2) if err != nil { t.Fatal(err) @@ -28,13 +28,13 @@ func chooseTakesTheAgreedNodesWithFewestRunningStepsTiesByName(t *testing.T) { / if len(nodes) != 2 || nodes[0] != "shanks" || nodes[1] != "ace" { t.Errorf("nodes = %v, want [shanks ace]: fewest steps first, a tie by name", nodes) } - if tc.Version != "go1.27.1" || tc.Recipe != "1" || tc.Language != "go" { + if tc.Version != "go1.27" || tc.Recipe != "1" || tc.Language != "go" { t.Errorf("toolchain = %+v", tc) } } func chooseWithOneNodeAnswersOneNode(t *testing.T) { // 1607/AC4 - nodes, _, err := ChooseNodes("go", tcs("go", "go1.27.1", "novox"), nil, nil, 2) + nodes, _, err := ChooseNodes("go", tcs("go", "go1.27", "novox"), nil, nil, 2) if err != nil || len(nodes) != 1 || nodes[0] != "novox" { t.Errorf("nodes = %v, err %v, want [novox]", nodes, err) } @@ -45,9 +45,9 @@ func chooseFailsNamingTheLanguageAndTheVersionsWhenNoNodeQualifies(t *testing.T) if err == nil || !strings.Contains(err.Error(), "typescript") || !strings.Contains(err.Error(), buildstep.ToolchainNoReport) { t.Errorf("no report: error = %v, want it to name typescript and %q", err, buildstep.ToolchainNoReport) } - entries := append(tcs("go", "go1.27.1", "novox"), tcs("go", "go1.26.0", "ace")...) + entries := append(tcs("go", "go1.27", "novox"), tcs("go", "go1.26.0", "ace")...) _, _, err = ChooseNodes("go", entries, nil, nil, 2) - if err == nil || !strings.Contains(err.Error(), "go1.27.1") || !strings.Contains(err.Error(), "go1.26.0") || !strings.Contains(err.Error(), "go") { + if err == nil || !strings.Contains(err.Error(), "go1.27") || !strings.Contains(err.Error(), "go1.26") || !strings.Contains(err.Error(), "go") { t.Errorf("disagreeing nodes: error = %v, want both versions named", err) } } @@ -67,17 +67,17 @@ func agreeNeedsEqualDigestsAndNamesBothNodesWhenTheyDiffer(t *testing.T) { // 16 } func chooseSkipsNodesThatAreNotOnlineAndFailsNamingThemWhenNoneIs(t *testing.T) { // 1607 review 3, ADR 0478 clause 3 - entries := tcs("go", "go1.27.1", "ace", "g14", "novox") + entries := tcs("go", "go1.27", "ace", "g14", "novox") online := func(n string) bool { return n != "g14" } // a sleeping laptop nodes, tc, err := ChooseNodes("go", entries, placesRunning(map[string]int{"novox": 5}), online, 2) - if err != nil || len(nodes) != 2 || nodes[0] != "ace" || nodes[1] != "novox" || tc.Version != "go1.27.1" { + if err != nil || len(nodes) != 2 || nodes[0] != "ace" || nodes[1] != "novox" || tc.Version != "go1.27" { t.Errorf("nodes = %v, toolchain %+v, err %v, want [ace novox] with g14 left out although it runs nothing", nodes, tc, err) } _, tc, err = ChooseNodes("go", entries, nil, func(string) bool { return false }, 2) if err == nil || !strings.Contains(err.Error(), "online") || !strings.Contains(err.Error(), "g14") || !strings.Contains(err.Error(), "go") { t.Errorf("none online: error = %v, want it to name the nodes that report and that none is online", err) } - if tc.Version != "go1.27.1" { + if tc.Version != "go1.27" { t.Errorf("none online: the agreed toolchain %+v is still answered", tc) } } @@ -88,7 +88,7 @@ func placesRunning(running map[string]int) *Places { } func choosePrefersNodesBelowTheirCapacity(t *testing.T) { // round 3 - entries := tcs("go", "go1.27.1", "ace", "novox", "shanks") + entries := tcs("go", "go1.27", "ace", "novox", "shanks") // shanks has capacity 3 with 2 running: room; ace has the default 1 with 1 running: none; novox has none running. p := placesRunning(map[string]int{"shanks": 2, "ace": 1}) p.Capacity = map[string]int{"shanks": 3} diff --git a/modules/mesh-delivery-builder/buildrun/toolchaingate_test.go b/modules/mesh-delivery-builder/buildrun/toolchaingate_test.go index 3e41cc44..7f469377 100644 --- a/modules/mesh-delivery-builder/buildrun/toolchaingate_test.go +++ b/modules/mesh-delivery-builder/buildrun/toolchaingate_test.go @@ -58,7 +58,7 @@ func TestToolchainGate(t *testing.T) { t.Run("not placed on ace: its report is no builder's", func(t *testing.T) { gate, set, said := start(t, true) - key, value := gateReport(t, "ace", "v26.12.0", old) + key, value := gateReport(t, "ace", "v26.11.0", old) gate.Toolchain(testNode, key, value, false) if a := buildstep.ToolchainAgreement(set.Entries("typescript")); len(a.SittingOut) != 1 || a.SittingOut[0].Node != "ace" { // ADR 0584: the majority is agreed, ace's report counts as the one that sits out t.Fatalf("before the assignments is settled every report counts; got %+v", a) @@ -68,7 +68,7 @@ func TestToolchainGate(t *testing.T) { if !gate.Settled() { t.Fatal("settling left ace's report out, so what was passed on changed") } - if v, none := agreedOf(set); v != "v26.12.1" || none != "" { + if v, none := agreedOf(set); v != "v26.12" || none != "" { t.Fatalf("the placed nodes agree on v26.12.1; got %q, %q", v, none) } if len(*said) != 1 || !strings.Contains((*said)[0], "does not place mesh-build-node on ace") { @@ -80,14 +80,14 @@ func TestToolchainGate(t *testing.T) { // Placed on ace with a report written since: it counts, and the builders really disagree. k, v = placing(t, "ace", testGo, testNode) gate.Assignments(k, v, false, old.Add(-time.Minute)) - if a := buildstep.ToolchainAgreement(set.Entries("typescript")); a.Toolchain.Version != "v26.12.1" || len(a.SittingOut) != 1 || a.SittingOut[0].Version != "v26.12.0" { + if a := buildstep.ToolchainAgreement(set.Entries("typescript")); a.Toolchain.Version != "v26.12" || len(a.SittingOut) != 1 || a.SittingOut[0].Version != "v26.11" { t.Fatalf("builders that run different versions: the majority is agreed and ace sits out; got %+v", a) } // Taken off ace again (its key deleted): its report goes again. if !gate.Assignments(k, nil, true, placed) { t.Fatal("taking ace's assignments away passed nothing on") } - if v, none := agreedOf(set); v != "v26.12.1" || none != "" { + if v, none := agreedOf(set); v != "v26.12" || none != "" { t.Fatalf("got %q, %q", v, none) } // A report deleted from the bucket goes whether its node is placed or not. @@ -131,7 +131,7 @@ func TestToolchainGate(t *testing.T) { if gate.Assignments(k, v, false, placed) { t.Fatal("assignments with no report passed something on") } - key, value := gateReport(t, "ace", "v26.12.0", c.at) + key, value := gateReport(t, "ace", "v26.11.0", c.at) if got := gate.Toolchain(testNode, key, value, false); got != c.counts { t.Fatalf("ace's report passed on: %v, want %v", got, c.counts) } @@ -143,7 +143,7 @@ func TestToolchainGate(t *testing.T) { if c.counts { return } - if v, none := agreedOf(set); v != "v26.12.1" || none != "" { + if v, none := agreedOf(set); v != "v26.12" || none != "" { t.Fatalf("ace's left report is no builder's; got %q, %q", v, none) } if len(*said) != 1 || !strings.Contains((*said)[0], "before mesh-build-node was placed on ace at 2026-10-25T19:56:45Z") { @@ -158,7 +158,7 @@ func TestToolchainGate(t *testing.T) { t.Run("no assignments held: every report counts", func(t *testing.T) { gate, set, _ := start(t, false) - key, value := gateReport(t, "ace", "v26.12.0", old) + key, value := gateReport(t, "ace", "v26.11.0", old) gate.Toolchain(testNode, key, value, false) gate.Settled() if n := len(set.Entries("typescript")); n != 4 { @@ -183,7 +183,7 @@ func TestToolchainGate(t *testing.T) { for _, node := range append([]string{"ace"}, three...) { key, value := gateReport(t, node, "v26.12.1", placed.Add(time.Minute)) if node == "ace" { - key, value = gateReport(t, node, "v26.12.0", old) + key, value = gateReport(t, node, "v26.11.0", old) } gate.Toolchain(testNode, key, value, false) } diff --git a/modules/mesh-delivery-builder/buildrun/toolchains_test.go b/modules/mesh-delivery-builder/buildrun/toolchains_test.go index 5f8fa1a8..48620524 100644 --- a/modules/mesh-delivery-builder/buildrun/toolchains_test.go +++ b/modules/mesh-delivery-builder/buildrun/toolchains_test.go @@ -41,7 +41,7 @@ func TestDigestsOfTheAgreedVersion(t *testing.T) { {Node: "novox", Toolchain: tc("go", "1.26.0", "sha256:b")}, {Node: "ace", Toolchain: tc("go", "1.26.0", "sha256:a")}, {Node: "g14", Toolchain: tc("go", "1.26.0", "sha256:a")}, {Node: "shanks", Toolchain: tc("go", "1.25.0", "sha256:c")}, {Node: "old", Toolchain: tc("go", "1.26.0", "")}} - got := Digests(entries, tc("go", "1.26.0", "")) + got := Digests(entries, buildstep.ToolchainAgreement(entries[:4]).Toolchain) want := []AgreedDigest{{Digest: "sha256:a", Nodes: []string{"ace", "g14"}}, {Digest: "sha256:b", Nodes: []string{"novox"}}} if !reflect.DeepEqual(got, want) { t.Errorf("digests = %+v, want %+v", got, want) diff --git a/modules/mesh-delivery-sdk/steprun/askrun.go b/modules/mesh-delivery-sdk/steprun/askrun.go index 60f3a7c8..935ad7b6 100644 --- a/modules/mesh-delivery-sdk/steprun/askrun.go +++ b/modules/mesh-delivery-sdk/steprun/askrun.go @@ -160,9 +160,9 @@ func (s AskSteps) onToolchain(ctx context.Context, want *sdkstep.ToolchainUsed) return nil, err } if !sdkstep.SameToolchainVersion(tc.Version, want.Version) || tc.Recipe != want.Recipe { - return nil, &Declining{Lacks: []string{fmt.Sprintf("the agreed toolchain %s (recipe %s)", want.Version, want.Recipe)}, + return nil, &Declining{Lacks: []string{fmt.Sprintf("the agreed toolchain %s (recipe %s)", sdkstep.LanguageVersion(want.Version), want.Recipe)}, Text: fmt.Sprintf("the ask is for %s (recipe %s) and this node builds with %s (recipe %s): it sits out, and the ask is left to a node on the agreed toolchain", - want.Version, want.Recipe, tc.Version, tc.Recipe)} + sdkstep.LanguageVersion(want.Version), want.Recipe, sdkstep.LanguageVersion(tc.Version), tc.Recipe)} } tc.Version = sdkstep.LanguageVersion(tc.Version) // named by its language version, the patch not counted (A-471) return &tc, nil diff --git a/modules/mesh-delivery-sdk/steprun/guard.go b/modules/mesh-delivery-sdk/steprun/guard.go index ecaeb38c..a5f995a9 100644 --- a/modules/mesh-delivery-sdk/steprun/guard.go +++ b/modules/mesh-delivery-sdk/steprun/guard.go @@ -45,8 +45,8 @@ func (g Guard) Check(ctx context.Context) error { return fmt.Errorf("steprun: writing the toolchain %s: %w", key, err) } if !sdkstep.SameToolchainVersion(installed, g.Want) { - return &Refusal{Text: fmt.Sprintf("%s %s installed, the recipe builds with %s %s", g.Language, installed, g.Language, g.Want), - Want: g.Want, Have: installed} + return &Refusal{Text: fmt.Sprintf("%s %s installed, the recipe builds with %s %s", g.Language, sdkstep.LanguageVersion(installed), g.Language, sdkstep.LanguageVersion(g.Want)), + Want: sdkstep.LanguageVersion(g.Want), Have: sdkstep.LanguageVersion(installed)} } return nil } diff --git a/modules/mesh-delivery-sdk/steprun/guard_test.go b/modules/mesh-delivery-sdk/steprun/guard_test.go index b9449995..c3c619b3 100644 --- a/modules/mesh-delivery-sdk/steprun/guard_test.go +++ b/modules/mesh-delivery-sdk/steprun/guard_test.go @@ -58,7 +58,7 @@ func TestCheckRefusesAnotherVersionAndWritesTheInstalledOne(t *testing.T) { if !errors.As(err, &ref) { t.Fatalf("Check = %v, want a Refusal", err) } - if ref.Text != "go 1.28.1 installed, the recipe builds with go 1.27.0" || ref.Want != "1.27.0" || ref.Have != "1.28.1" { + if ref.Text != "go 1.28 installed, the recipe builds with go 1.27" || ref.Want != "1.27" || ref.Have != "1.28" { t.Errorf("refusal = %+v", ref) } if k["ace.go"].Version != "1.28" {