A state entry may say key-ttl and its bucket allows a time to live per key (issue 1154)
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user