Files
mesh-controller/internal/broker/provisioner_have_test.go
T
jschoubben 3dadc46ee6
mesh/delivery checking
mesh/delivery-group group fix/r6-node-composition held: a member is held: novox/mesh-sdk@10b6e202320f (merged without a passing check: only a person decides wh…
mesh/check checking 3dadc46ee6cc on ba4d15657343 | novox/mesh-controller#458 in group fix/r6-node-composition
Grant each provisioner client a read of its node's own have, so it refills when the node's own composition moves (issue 1945)
2026-10-25 01:58:27 +02:00

30 lines
1.1 KiB
Go

package broker
import (
"slices"
"testing"
)
// The provisioner client reads its own node's own have, `<node>.node` in node-engine_have, and no other key of it: it
// fills every module again when the node-engine moves to a new composition of the node's own (issue 1945, live on
// 2026-10-25: the files a composition had written empty were refilled by nothing).
func TestTheProvisionerReadsItsNodesOwnHaveAlone(t *testing.T) {
p, err := PermissionsFor(Principal{Kind: KindProvisioner, Node: "g14", PasswordHash: "x"})
if err != nil {
t.Fatal(err)
}
for _, want := range []string{"$JS.API.STREAM.INFO.KV_node-engine_have",
"$JS.API.DIRECT.GET.KV_node-engine_have.$KV.node-engine_have.g14.node",
"$JS.API.CONSUMER.CREATE.KV_node-engine_have.*.$KV.node-engine_have.g14.node"} {
if !slices.Contains(p.Publish, want) {
t.Errorf("the provisioner may not %s", want)
}
}
for _, s := range p.Publish {
if s == "$JS.API.DIRECT.GET.KV_node-engine_have.$KV.node-engine_have.g14.>" ||
s == "$JS.API.DIRECT.GET.KV_node-engine_have.>" || s == "$KV.node-engine_have.g14.node" {
t.Errorf("the provisioner is granted %s", s)
}
}
}