diff --git a/module.json b/module.json index b71573b..2f3da06 100644 --- a/module.json +++ b/module.json @@ -14,13 +14,21 @@ } ] }, + "invokes": [ + "seat:mesh-catalog.seat-definitions" + ], "consumes": [ + "mesh-catalog.seat-definition-changed", + "mesh-catalog.seat-definition-removed", "restic.backed-up" ], "state": [ { "name": "health" }, + { + "name": "findings" + }, { "name": "data" }, diff --git a/packaging/operator_keys_test.go b/packaging/operator_keys_test.go index 5c77c08..487579a 100644 --- a/packaging/operator_keys_test.go +++ b/packaging/operator_keys_test.go @@ -3,6 +3,7 @@ package packaging_test import ( "encoding/json" "os" + "slices" "strings" "testing" @@ -65,8 +66,9 @@ func TestTheManifestConsumesTheBackupEvent(t *testing.T) { if err := json.Unmarshal(raw, &m); err != nil { t.Fatal(err) } - if len(m.Consumes) != 1 || m.Consumes[0] != "restic.backed-up" { - t.Fatalf("consumes %v", m.Consumes) + // The backup event, and the two events of the seat that serves the seat list (ADR 0636 §4). + if want := []string{"mesh-catalog.seat-definition-changed", "mesh-catalog.seat-definition-removed", "restic.backed-up"}; !slices.Equal(m.Consumes, want) { + t.Fatalf("consumes %v, want %v", m.Consumes, want) } // 774: the acts bucket mesh-host_acts is not declared as state for now: a declared state of a module with no account // of its own is carried by every node's tool runner, which would be a second writer of the engine's own keys and @@ -87,9 +89,12 @@ func TestTheManifestConsumesTheBackupEvent(t *testing.T) { // ADR 0577 clause 1: and the state data, one key per module placed on the node that declares data items, kept until // the module leaves the node; created by the grants part from this manifest as health is. // ADR 0565 clause 6: and the state packages, one key per node, its compositions' declared packages, read by pacman. - if len(parsed.State) != 3 || parsed.State[0].Name != "health" || parsed.State[0].TTLSeconds != 0 || - parsed.State[1].Name != "data" || parsed.State[1].TTLSeconds != 0 || parsed.State[2].Name != "packages" || - parsed.State[2].TTLSeconds != 0 { + // ADR 0564 §2, ADR 0636 §1: and the state findings, the node's finding that it waits for the seat list (no TTL: the + // finding stays until the first full read deletes its key). + if len(parsed.State) != 4 || parsed.State[0].Name != "health" || parsed.State[0].TTLSeconds != 0 || + parsed.State[1].Name != "findings" || parsed.State[1].TTLSeconds != 0 || + parsed.State[2].Name != "data" || parsed.State[2].TTLSeconds != 0 || parsed.State[3].Name != "packages" || + parsed.State[3].TTLSeconds != 0 { t.Fatalf("the manifest declares the state %+v", parsed.State) } }