package buscompose import "testing" // Design 47 G A-77, A-92: the node-engine's account is granted the state bounds, to write a bound key with its time to live, // to delete it, and to watch it for the bus's marker; and no other node-engine state or module's bucket by that grant. func TestTheNodeEngineIsGrantedItsBoundsState(t *testing.T) { users, err := Users(Records{Nodes: []string{"one"}, Engine: &Declared{Module: EngineModule}}) if err != nil { t.Fatal(err) } var node Principal for _, u := range users { if u.Kind == KindNode { node = u } } perms, err := PermissionsFor(node) if err != nil { t.Fatal(err) } for _, want := range []string{ "$KV.mesh-host_bounds.recovery.act-1", "$JS.API.STREAM.INFO.KV_mesh-host_bounds", "$JS.API.CONSUMER.CREATE.KV_mesh-host_bounds.*.$KV.mesh-host_bounds.recovery.act-1", "$JS.API.CONSUMER.DELETE.KV_mesh-host_bounds.x", } { if !MayPublish(perms, want) { t.Errorf("the node-engine of one may not publish %s", want) } } if MayPublish(perms, "$KV.other_bounds.recovery.act-1") { t.Error("the node-engine of one may publish another module's bounds") } }