diff --git a/internal/bootstrap/bus_adoption_test.go b/internal/bootstrap/bus_adoption_test.go index cbb52e9..1c16bf1 100644 --- a/internal/bootstrap/bus_adoption_test.go +++ b/internal/bootstrap/bus_adoption_test.go @@ -108,28 +108,35 @@ func TestABusStepThatEndsFailedIsRefused(t *testing.T) { } } -// The bundle's bus runs the release the module's image is built on, pinned by the same digest, so the -// adoption changes no server release and is reversible as the step says (ADR 0333 §3). +// The bundle's bus runs the release the module's server is, pinned by the same digest, so the adoption changes no +// server release and is reversible as the step says (ADR 0333 §3). The module takes the server as an upstream +// artifact, its image reference pinned by digest (issue 1641); it no longer builds an image on a NATS_BASE argument, +// which this test read until issue 1875. func TestTheBundlesBusRunsTheReleaseTheModulesImageIsBuiltOn(t *testing.T) { var m struct { Build struct { - On []struct{ Arg, Image string } `json:"on"` + Artifacts []struct{ Name, Kind, From string } `json:"artifacts"` } `json:"build"` } if err := json.Unmarshal(theCataloguesModule(t, BusModule), &m); err != nil { t.Fatal(err) } - base := "" - for _, on := range m.Build.On { - if on.Arg == "NATS_BASE" { - base = on.Image + from := "" + for _, a := range m.Build.Artifacts { + if a.Name == "server" && a.Kind == "upstream" { + from = a.From } } + name, digest, pinned := strings.Cut(from, "@") + if !pinned || !strings.HasPrefix(digest, "sha256:") { + t.Fatalf("the nats module's server is no upstream image pinned by digest: %q", from) + } + repository, _, _ := strings.Cut(name, ":") rewritten, err := Rewrite(theRealBundle(t), held) if err != nil { t.Fatal(err) } - if got := containerNamed(rewritten.Declaration, "mesh-broker-nats").Image; got != base { - t.Errorf("the bundle raises the bus on %s; the nats module's image is built on %s", got, base) + if got, want := containerNamed(rewritten.Declaration, "mesh-broker-nats").Image, repository+"@"+digest; got != want { + t.Errorf("the bundle raises the bus on %s; the nats module's server is %s (%s)", got, want, from) } }