The controller plans config, templates and moved providers' provisions, hands bus accounts to the vault and judges the new manifest words, on the feature's SDK and node-engine validator (feature 57, config and provisioning).
35 lines
1.2 KiB
Go
35 lines
1.2 KiB
Go
package broker
|
|
|
|
import (
|
|
"slices"
|
|
"testing"
|
|
)
|
|
|
|
// **The bus module's watch speaks through the runtime that carries it** (novox/hq ADR 0357): the node's
|
|
// runtime is granted the events the bus module declares, under the module's name, while the bus's own
|
|
// account keeps the snapshot API and nothing else (ADR 0235).
|
|
func TestTheRuntimeCarryingTheBusModuleMayPublishItsEventsAndTheBussAccountMayNot(t *testing.T) {
|
|
events := []string{"bus.slow-consumer", "bus.connection-closed"}
|
|
runtime := Principal{Kind: KindNodeTools, Node: "anchor", Module: RuntimeModule,
|
|
Carries: []Declared{{Module: "nats", Emits: events}}}
|
|
p, err := PermissionsFor(runtime)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
for _, e := range events {
|
|
if !slices.Contains(p.Publish, "mesh.mod.nats.event."+e) {
|
|
t.Errorf("the runtime carrying the bus module may not publish %s: %v", e, p.Publish)
|
|
}
|
|
}
|
|
account := Principal{Kind: KindModule, Node: "anchor", Module: "nats", Emits: events, SnapshotsTheBus: true}
|
|
a, err := PermissionsFor(account)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
for _, s := range a.Publish {
|
|
if s == "mesh.mod.nats.event.bus.slow-consumer" || s == "mesh.mod.nats.event.bus.connection-closed" {
|
|
t.Errorf("the bus's own account is granted %s", s)
|
|
}
|
|
}
|
|
}
|