diff --git a/modules/nats/cmd/nats-tools/manifest_test.go b/modules/nats/cmd/nats-tools/manifest_test.go index 57b4a3fc..93e0a8b3 100644 --- a/modules/nats/cmd/nats-tools/manifest_test.go +++ b/modules/nats/cmd/nats-tools/manifest_test.go @@ -32,6 +32,13 @@ func TestTheBussManifestMountsItsProgramsIntoTheUpstreamImage(t *testing.T) { } `json:"backup"` } `json:"own"` } `json:"data"` + Provides []struct { + Name string `json:"name"` + Scope string `json:"scope"` + Credential struct { + Form string `json:"form"` + } `json:"credential"` + } `json:"provides"` Tools []string `json:"tools"` Emits []string `json:"emits"` Resources []map[string]any `json:"resources"` @@ -43,6 +50,16 @@ func TestTheBussManifestMountsItsProgramsIntoTheUpstreamImage(t *testing.T) { if err := json.Unmarshal(raw, &m); err != nil { t.Fatal(err) } + // The bus provides "bus-state" beside "mesh-bus" (ADR 0614 ยง5): a module whose manifest keeps bus state requires it. + provided := map[string]string{} + for _, p := range m.Provides { + provided[p.Name] = p.Scope + "/" + p.Credential.Form + } + for _, name := range []string{"mesh-bus", "bus-state"} { + if provided[name] != "mesh/none" { + t.Errorf("provision %q is %q: the bus provides it mesh-wide with no credential", name, provided[name]) + } + } if m.Build.On != nil { t.Error("build.on is declared: nothing is built on a base image any more") } diff --git a/modules/nats/module.json b/modules/nats/module.json index 93f518d7..3e58475c 100644 --- a/modules/nats/module.json +++ b/modules/nats/module.json @@ -12,6 +12,13 @@ "credential": { "form": "none" } + }, + { + "name": "bus-state", + "scope": "mesh", + "credential": { + "form": "none" + } } ], "claims": [