diff --git a/module.json b/module.json index 52f97f17..82b00dec 100644 --- a/module.json +++ b/module.json @@ -51,6 +51,11 @@ }, { "name": "packages" + }, + { + "name": "bounds", + "history": 1, + "key-ttl": true } ], "config": { diff --git a/packaging/bounds_state_test.go b/packaging/bounds_state_test.go new file mode 100644 index 00000000..d92beab9 --- /dev/null +++ b/packaging/bounds_state_test.go @@ -0,0 +1,30 @@ +package packaging_test + +import ( + "os" + "testing" + + "git.novox.be/novox/mesh-sdk/go/catalogue" +) + +// The node-engine's waits run against bound keys with their own time to live, in its old section as its other states are +// (design 47 G A-92, §560, §627): the manifest declares the state bounds with a lifetime per key. +func TestTheManifestDeclaresTheBoundsStateWithAKeyLifetime(t *testing.T) { + raw, err := os.ReadFile("../module.json") + if err != nil { + t.Fatal(err) + } + m, err := catalogue.Decode(raw) + if err != nil { + t.Fatalf("the manifest no longer parses: %v", err) + } + for _, s := range m.State { + if s.Name == "bounds" { + if !s.KeyTTL || s.History != 1 { + t.Fatalf("the state bounds is %+v: one value a key, each key with its own lifetime", s) + } + return + } + } + t.Fatal("the manifest declares no state bounds") +} diff --git a/packaging/operator_keys_test.go b/packaging/operator_keys_test.go index d620eef7..2c6ca2ca 100644 --- a/packaging/operator_keys_test.go +++ b/packaging/operator_keys_test.go @@ -91,10 +91,11 @@ func TestTheManifestConsumesTheBackupEvent(t *testing.T) { // ADR 0565 clause 6: and the state packages, one key per node, its compositions' declared packages, read by pacman. // 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 || + // Design 47 G A-92: and the state bounds, each key a wait's bound with its own lifetime (packaging/bounds_state_test.go). + if len(parsed.State) != 5 || 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 { + parsed.State[3].TTLSeconds != 0 || parsed.State[4].Name != "bounds" { t.Fatalf("the manifest declares the state %+v", parsed.State) } }