From 1481465ec78fe563d4213ff6cd0c8851ea58a186 Mon Sep 17 00:00:00 2001 From: jochen Date: Tue, 17 Nov 2026 15:12:25 +0100 Subject: [PATCH] A-471: the build modules' tests expect the language version in a toolchain report The toolchain a build module reports (guard key and toolchain-reported event) names the language version alone (mesh-delivery-sdk steprun Guard); the build module's own Toolchain func keeps the installed text. Delivered with or after the sdk change. Builds: design 47 G A-471 (G-22-lead-answers-2.md) --- modules/mesh-build-go/cmd/mesh-build-go/emit_test.go | 4 ++-- .../cmd/mesh-build-go/installed_toolchain_test.go | 4 ++-- modules/mesh-build-node/cmd/mesh-build-node/emit_test.go | 4 ++-- .../cmd/mesh-build-node/installed_toolchain_test.go | 5 +++-- modules/mesh-build-node/cmd/mesh-build-node/module_test.go | 4 ++-- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/modules/mesh-build-go/cmd/mesh-build-go/emit_test.go b/modules/mesh-build-go/cmd/mesh-build-go/emit_test.go index fe43817da..c9b5f6f70 100644 --- a/modules/mesh-build-go/cmd/mesh-build-go/emit_test.go +++ b/modules/mesh-build-go/cmd/mesh-build-go/emit_test.go @@ -34,7 +34,7 @@ func TestTheGuardSaysToolchainReportedOnAChangeWithTheProgramDigest(t *testing.T t.Fatal(err) } if len(got) != 1 || got[0].subject != "mesh.seat.node-build-go.event.toolchain-reported.ace" || got[0].body["node"] != "ace" || got[0].body["language"] != "go" || - got[0].body["version"] != "go1.27.1" || got[0].body["recipe"] != m.Recipe.Version() || len(got[0].body["digest"]) != len("sha256:")+64 { + got[0].body["version"] != "go1.27" || got[0].body["recipe"] != m.Recipe.Version() || len(got[0].body["digest"]) != len("sha256:")+64 { t.Fatalf("events = %+v, want one toolchain-reported for ace, go with the program's digest", got) } if tc, _ := states.toolchain("ace.go"); tc.Digest != got[0].body["digest"] { @@ -51,7 +51,7 @@ func TestTheGuardSaysToolchainReportedOnAChangeWithTheProgramDigest(t *testing.T os.WriteFile(prog, []byte("another go program"), 0o755) m.Probe = func(context.Context) (string, error) { return "go1.27.2", nil } m.Check(context.Background()) - if len(got) != 2 || got[1].body["version"] != "go1.27.2" || got[1].body["digest"] == got[0].body["digest"] { + if len(got) != 2 || got[1].body["version"] != "go1.27" || got[1].body["digest"] == got[0].body["digest"] { t.Errorf("a new version said %+v, want a second event with another digest", got) } } diff --git a/modules/mesh-build-go/cmd/mesh-build-go/installed_toolchain_test.go b/modules/mesh-build-go/cmd/mesh-build-go/installed_toolchain_test.go index fd631601f..e1fe33d8c 100644 --- a/modules/mesh-build-go/cmd/mesh-build-go/installed_toolchain_test.go +++ b/modules/mesh-build-go/cmd/mesh-build-go/installed_toolchain_test.go @@ -149,8 +149,8 @@ func TestAnyInstalledGoIsHealthyNamedAndReported(t *testing.T) { t.Errorf("health = %+v, want healthy naming %s", a, installed) } tc, ok := states.toolchain("ace.go") - if !ok || tc.Version != installed || tc.Recipe != m.Recipe.Version() { - t.Errorf("ace.go = %+v, %v; want version %s and recipe %s", tc, ok, installed, m.Recipe.Version()) + if !ok || tc.Version != sdkstep.LanguageVersion(installed) || tc.Recipe != m.Recipe.Version() { + t.Errorf("ace.go = %+v, %v; want version %s and recipe %s", tc, ok, sdkstep.LanguageVersion(installed), m.Recipe.Version()) } ran := false run := func(context.Context, map[string]any) (any, error) { ran = true; return "done", nil } diff --git a/modules/mesh-build-node/cmd/mesh-build-node/emit_test.go b/modules/mesh-build-node/cmd/mesh-build-node/emit_test.go index 4be2ed41e..b9ce80030 100644 --- a/modules/mesh-build-node/cmd/mesh-build-node/emit_test.go +++ b/modules/mesh-build-node/cmd/mesh-build-node/emit_test.go @@ -34,7 +34,7 @@ func TestTheGuardSaysToolchainReportedOnAChangeWithTheProgramDigest(t *testing.T t.Fatal(err) } if len(got) != 1 || got[0].subject != "mesh.seat.node-build-node.event.toolchain-reported.ace" || got[0].body["node"] != "ace" || got[0].body["language"] != "typescript" || - got[0].body["version"] != "v26.10.0" || got[0].body["recipe"] != m.Recipe.Version() || len(got[0].body["digest"]) != len("sha256:")+64 { + got[0].body["version"] != "v26.10" || got[0].body["recipe"] != m.Recipe.Version() || len(got[0].body["digest"]) != len("sha256:")+64 { t.Fatalf("events = %+v, want one toolchain-reported for ace, go with the program's digest", got) } if tc, _ := states.toolchain("ace.typescript"); tc.Digest != got[0].body["digest"] { @@ -51,7 +51,7 @@ func TestTheGuardSaysToolchainReportedOnAChangeWithTheProgramDigest(t *testing.T os.WriteFile(prog, []byte("another node program"), 0o755) m.Probe = func(context.Context) (string, error) { return "v26.11.0", nil } m.Check(context.Background()) - if len(got) != 2 || got[1].body["version"] != "v26.11.0" || got[1].body["digest"] == got[0].body["digest"] { + if len(got) != 2 || got[1].body["version"] != "v26.11" || got[1].body["digest"] == got[0].body["digest"] { t.Errorf("a new version said %+v, want a second event with another digest", got) } } diff --git a/modules/mesh-build-node/cmd/mesh-build-node/installed_toolchain_test.go b/modules/mesh-build-node/cmd/mesh-build-node/installed_toolchain_test.go index e4b7841cb..dd32ced5a 100644 --- a/modules/mesh-build-node/cmd/mesh-build-node/installed_toolchain_test.go +++ b/modules/mesh-build-node/cmd/mesh-build-node/installed_toolchain_test.go @@ -8,6 +8,7 @@ import ( "strings" "testing" + sdkstep "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep" "git.novox.be/novox/mesh-sdk/go/health" ) @@ -36,8 +37,8 @@ func TestAnyInstalledNodeIsHealthyNamedAndReported(t *testing.T) { t.Errorf("health = %+v, want healthy naming %s", a, installed) } tc, ok := states.toolchain("ace.typescript") - if !ok || tc.Version != installed || tc.Recipe != m.Recipe.Version() { - t.Errorf("ace.typescript = %+v, %v; want version %s and recipe %s", tc, ok, installed, m.Recipe.Version()) + if !ok || tc.Version != sdkstep.LanguageVersion(installed) || tc.Recipe != m.Recipe.Version() { + t.Errorf("ace.typescript = %+v, %v; want version %s and recipe %s", tc, ok, sdkstep.LanguageVersion(installed), m.Recipe.Version()) } if err := m.Prepare(context.Background()); err != nil { t.Errorf("no step can run on node %s: %v", installed, err) diff --git a/modules/mesh-build-node/cmd/mesh-build-node/module_test.go b/modules/mesh-build-node/cmd/mesh-build-node/module_test.go index c733a82ec..a04ed8e4f 100644 --- a/modules/mesh-build-node/cmd/mesh-build-node/module_test.go +++ b/modules/mesh-build-node/cmd/mesh-build-node/module_test.go @@ -94,8 +94,8 @@ func TestStartWritesTheToolchainAndHealthIsHealthy(t *testing.T) { break } } - if tc.Version != "v26.10.0" || tc.Recipe != m.Recipe.Version() || tc.Language != "typescript" { - t.Fatalf("ace.typescript = %+v, want v26.10.0 and recipe %s", tc, m.Recipe.Version()) + if tc.Version != "v26.10" || tc.Recipe != m.Recipe.Version() || tc.Language != "typescript" { + t.Fatalf("ace.typescript = %+v, want v26.10 and recipe %s", tc, m.Recipe.Version()) } if a := m.Health(ctx); a.State != health.StateHealthy || !a.Healthy { t.Errorf("health = %+v, want healthy", a)