package broker import ( "slices" "testing" ) // The provisioner client reads its own node's own have, `.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) } } }