Node-engine manifest: invokes the seat mesh-catalog's seat-definitions, consumes its two events, keeps the state findings (H-7, ADR 0636; issue 1966)
This commit is contained in:
@@ -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"
|
||||
},
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user