From ea69e795ab9dba1ccc4adb22a78fadef1615cc26 Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 8 Oct 2026 18:07:29 +0200 Subject: [PATCH] Read the tested nats release from the server itself The build seat's test binary listed no dependencies, so the check that the image and the tests run one release failed on a release that matched. --- modules/nats/cmd/nats-tools/server_test.go | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/modules/nats/cmd/nats-tools/server_test.go b/modules/nats/cmd/nats-tools/server_test.go index e9a2d07c..57ab02ee 100644 --- a/modules/nats/cmd/nats-tools/server_test.go +++ b/modules/nats/cmd/nats-tools/server_test.go @@ -7,7 +7,6 @@ import ( "net/http" "os" "regexp" - "runtime/debug" "sync" "testing" "time" @@ -28,19 +27,11 @@ func TestTheImageIsTheServerTestedHere(t *testing.T) { if said == nil { t.Fatal("the Dockerfile does not say which nats release its digest is (`# upstream: nats X.Y.Z-alpine`)") } - info, ok := debug.ReadBuildInfo() - if !ok { - t.Fatal("no build information to read the tested server's version from") + // The server's own word for its release, compiled into it: a test binary's build information may list + // no dependencies (the build seat's did not, so this read "these tests run no nats-server"). + if server.VERSION != string(said[1]) { + t.Fatalf("the image runs nats %s and these tests run %s: move them together", said[1], server.VERSION) } - for _, dep := range info.Deps { - if dep.Path == "github.com/nats-io/nats-server/v2" { - if dep.Version != "v"+string(said[1]) { - t.Fatalf("the image runs nats %s and these tests run %s: move them together", said[1], dep.Version) - } - return - } - } - t.Fatal("these tests run no nats-server") } // **A consumer with several filters is handed every message** (novox/hq issue 266).