A state entry may say key-ttl and its bucket allows a time to live per key (issue 1154)

This commit is contained in:
2026-10-18 20:53:42 +02:00
parent ba59283b4b
commit 3b49d7044f
8 changed files with 160 additions and 17 deletions
+1 -1
View File
@@ -269,7 +269,7 @@ func bucketsOf(m catalogue.Manifest) []broker.Bucket {
var out []broker.Bucket
for _, s := range m.State {
out = append(out, broker.Bucket{Module: m.Module, Name: s.Name, History: s.History, TTLSeconds: s.TTLSeconds,
PerMachine: s.PerMachine})
PerMachine: s.PerMachine, KeyTTL: s.KeyTTL})
}
return out
}
+16
View File
@@ -0,0 +1,16 @@
package inventory
import (
"testing"
"github.com/novox/mesh-controller/internal/catalogue"
)
// 1154/AC2: a module's state with key-ttl is composed into a bucket that carries KeyTTL; without it, none.
func TestAKeyTTLStateIsComposedIntoABucketThatSaysSo(t *testing.T) { // 1154/AC2
got := bucketsOf(catalogue.Manifest{Module: "mesh-delivery-watchman",
State: []catalogue.StateDeclaration{{Name: "pulse", KeyTTL: true}, {Name: "stuck"}}})
if len(got) != 2 || !got[0].KeyTTL || got[1].KeyTTL {
t.Fatalf("buckets composed as %+v", got)
}
}