diff --git a/modules/mesh-recovery/internal/recovery/manifest_test.go b/modules/mesh-recovery/internal/recovery/manifest_test.go index 61da8aa86..b68c808b9 100644 --- a/modules/mesh-recovery/internal/recovery/manifest_test.go +++ b/modules/mesh-recovery/internal/recovery/manifest_test.go @@ -31,18 +31,25 @@ type manifest struct { Type string `json:"type"` Serves []string `json:"serves"` Bus struct { + State []string `json:"state"` Invokes []string `json:"invokes"` } `json:"bus"` Health struct { - Tool string `json:"tool"` + Kind string `json:"kind"` } `json:"health"` } `json:"resources"` + RuntimeHealth struct { + Kind string `json:"kind"` + Tool string `json:"tool"` + } `json:"runtime-health"` + Requires []json.RawMessage `json:"requires"` } // The manifest says what the module is (design 47 G §554, §656, §657, §633, §564, §567): it claims the seat once for the // mesh serving every verb of the seat's definition, its process answers each of them itself (A-115: `serves` beside its -// `bus`), its health check names a tool it serves, its data item is `points`, its settings carry the design's defaults, -// and what the process invokes the module declares. +// `bus`), its health check is its tool beside the process's own check and its template states are its own by `requires` +// alone, the digests state taking the template's fixed cap (A-133, A-135), its data item is `points`, its settings carry +// the design's defaults, and what the process invokes the module declares. func TestTheManifestSaysWhatTheModuleIs(t *testing.T) { raw, err := os.ReadFile("../../module.json") if err != nil { @@ -79,8 +86,11 @@ func TestTheManifestSaysWhatTheModuleIs(t *testing.T) { if !slices.Equal(r.Serves, want) { t.Errorf("the process serves %v, want %v", r.Serves, want) } - if !slices.Contains(m.Tools, r.Health.Tool) || r.Health.Tool != "recovery_kept_points" { - t.Errorf("the health check names %q, a tool of %v", r.Health.Tool, m.Tools) + if r.Health.Kind != "unit" { + t.Errorf("the process's own check is %q, want unit", r.Health.Kind) + } + if len(r.Bus.State) != 0 { + t.Errorf("the process's bus lists the states %v again, which are the module's own by its requires", r.Bus.State) } for _, inv := range r.Bus.Invokes { if !slices.Contains(m.Invokes, inv) { @@ -88,6 +98,18 @@ func TestTheManifestSaysWhatTheModuleIs(t *testing.T) { } } } + if m.RuntimeHealth.Kind != "tool" || m.RuntimeHealth.Tool != "recovery_kept_points" || !slices.Contains(m.Tools, m.RuntimeHealth.Tool) { + t.Errorf("the tool check is %+v, want recovery_kept_points, a tool of %v", m.RuntimeHealth, m.Tools) + } + for _, raw := range m.Requires { + var q struct { + Name string `json:"name"` + Options map[string]any `json:"options"` + } + if json.Unmarshal(raw, &q) == nil && q.Name == "digests" && len(q.Options) != 0 { + t.Errorf("digests gives the options %v beside the template state's fixed cap", q.Options) + } + } for _, c := range []string{"node-backup.item-started", "node-backup.item-ended", "mesh-broker.snapshot-restored"} { if !slices.Contains(m.Consumes, c) { t.Errorf("does not consume %s", c) diff --git a/modules/mesh-recovery/module.json b/modules/mesh-recovery/module.json index fb68370b5..4eef18760 100644 --- a/modules/mesh-recovery/module.json +++ b/modules/mesh-recovery/module.json @@ -60,10 +60,7 @@ { "name": "digests", "storage": "key-value", - "template": "state", - "options": { - "max-mib": 4 - } + "template": "state" }, { "name": "findings", @@ -219,10 +216,6 @@ "seat:mesh-recovery.expire-points" ], "bus": { - "state": [ - "digests", - "findings" - ], "invokes": [ "seat:mesh-catalog.entry", "seat:mesh-module-assigner.assignments", @@ -233,15 +226,18 @@ ] }, "health": { - "kind": "tool", - "tool": "recovery_kept_points", - "interval": "60s", - "timeout": "10s", - "looks": 2, - "grace": "180s" + "kind": "unit" } } ], + "runtime-health": { + "kind": "tool", + "tool": "recovery_kept_points", + "interval": "60s", + "timeout": "10s", + "looks": 2, + "grace": "180s" + }, "build": { "artifacts": [ {