diff --git a/modules/mesh-healers/cmd/mesh-healers/manifest_test.go b/modules/mesh-healers/cmd/mesh-healers/manifest_test.go index 83f59216b..e1c1989cf 100644 --- a/modules/mesh-healers/cmd/mesh-healers/manifest_test.go +++ b/modules/mesh-healers/cmd/mesh-healers/manifest_test.go @@ -22,6 +22,12 @@ type manifest struct { Invokes []string `json:"invokes"` Reads []string `json:"reads"` State []json.RawMessage `json:"state"` + Streams []json.RawMessage `json:"streams"` + Requires []struct { + Name string `json:"name"` + Template string `json:"template"` + Options map[string]any `json:"options"` + } `json:"requires"` } // The manifest says what the code does: it claims the seat mesh-healers once for the mesh with its verbs (ADR 0564 §1, @@ -72,6 +78,19 @@ func TestTheManifestSaysWhatTheCodeDoes(t *testing.T) { if !states[AttemptsState] || !states[WouldState] || !states[WakesState] || states[FindingsState] { t.Errorf("the states take a key's own time to live as %v, want attempts, would and wakes alone", states) } + // Design 47 G §529: the healers are no foundation part, so the state `findings` and the finding stream are asked in + // `requires` (the templates `state` and `events`, the stream named `finding-events`), and the old stream + // `mesh-healers-findings` is declared no more. + got := map[string]string{} + for _, r := range m.Requires { + got[r.Name] = r.Template + if r.Name == "finding-events" && (len(r.Options["events"].([]any)) != 3 || r.Options["max-age-days"] != 7.0 || r.Options["max-mib"] != 16.0) { + t.Errorf("the finding stream's options are %v, want the three finding events, 7 days and 16 MiB", r.Options) + } + } + if got[FindingsState] != "state" || got["finding-events"] != "events" || len(m.Streams) != 0 { + t.Errorf("requires %v and %d old streams, want findings by state, finding-events by events and no old stream", got, len(m.Streams)) + } readBy := map[string]string{AttemptsState: HealersTool, WouldState: WouldTool, FindingsState: FindingsTool, WakesState: WakesTool, "a settle's end": HealTool, "an act on an event": HealTool, "S15's count": HealersTool + " recount=true"}