Fix 9.3: the nats keeper's process serves its four mesh-broker snapshot verbs, beside its bus

Builds: design 47 G A-109, A-110, A-115 (serves is a field of the process itself)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
2026-11-12 01:00:59 +01:00
parent 0acad94ba5
commit 5d1456257c
2 changed files with 39 additions and 0 deletions
@@ -282,3 +282,36 @@ func TestTheBussManifestMountsItsProgramsIntoTheUpstreamImage(t *testing.T) {
}
}
}
// The keeper's process declares the four verbs of the seat mesh-broker it answers itself, beside its `bus` (design 47 G
// A-109, A-110, A-115), and exactly the verbs its code answers.
func TestTheKeepersProcessServesTheVerbsItAnswers(t *testing.T) {
raw, err := os.ReadFile("../../module.json")
if err != nil {
t.Fatal(err)
}
var m struct {
Resources []struct {
ID string `json:"id"`
Serves []string `json:"serves"`
} `json:"resources"`
}
if err := json.Unmarshal(raw, &m); err != nil {
t.Fatal(err)
}
var served []string
for _, r := range m.Resources {
if r.ID == "keeper" {
served = r.Serves
}
}
var want []string
for verb := range snapshotAnswers(nil, nil, nil) {
want = append(want, "seat:mesh-broker."+verb)
}
slices.Sort(want)
slices.Sort(served)
if !slices.Equal(served, want) {
t.Errorf("the keeper process serves %v; its code answers %v", served, want)
}
}
+6
View File
@@ -276,6 +276,12 @@
"MESH_NATS_SNAPSHOT_KEEP_DAYS": "90",
"MESH_NATS_SNAPSHOTS_DIR": "${dir:keeper-state}"
},
"serves": [
"seat:mesh-broker.snapshot-get",
"seat:mesh-broker.snapshot-restore",
"seat:mesh-broker.snapshot-restore-cancel",
"seat:mesh-broker.snapshot-remove"
],
"bus": {
"state": [
"asked",