Review round 1: check the process's whole publish set, not merely that each wanted subject is in it (issue 1180)
This commit is contained in:
@@ -1,6 +1,10 @@
|
|||||||
package broker
|
package broker
|
||||||
|
|
||||||
import "testing"
|
import (
|
||||||
|
"slices"
|
||||||
|
"sort"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
// A module's process with a bus declaration gets a bus account of its own (novox/hq ADR 0436 §1, §2, §3,
|
// A module's process with a bus declaration gets a bus account of its own (novox/hq ADR 0436 §1, §2, §3,
|
||||||
// §5): named <machine>.<module>.<process id>, granted exactly its bus declaration and nothing of its
|
// §5): named <machine>.<module>.<process id>, granted exactly its bus declaration and nothing of its
|
||||||
@@ -28,21 +32,33 @@ func TestAProcessIsGrantedExactlyItsBusDeclaration(t *testing.T) {
|
|||||||
t.Fatalf("username: %q", got)
|
t.Fatalf("username: %q", got)
|
||||||
}
|
}
|
||||||
got := perms(t, p)
|
got := perms(t, p)
|
||||||
for _, s := range []string{
|
// review round 1, finding 8: the whole publish set, not merely that each wanted subject is somewhere in
|
||||||
"mesh.mod.mesh-mail.event.mail.send.sent",
|
// it — AC1 says "exactly". Dumped from a passing run (TestZZDumpProcessPublish, removed): 16 subjects,
|
||||||
"mesh.mod.mesh-mail.event.mail.send.failed",
|
// correct today.
|
||||||
|
wantPublish := []string{
|
||||||
|
"$JS.ACK.MAIL_SENDS.novox_mesh-mail_send.>",
|
||||||
|
"$JS.API.CONSUMER.CREATE.KV_mesh-mail_sends.>",
|
||||||
|
"$JS.API.CONSUMER.DELETE.KV_mesh-mail_sends.>",
|
||||||
"$JS.API.CONSUMER.INFO.MAIL_SENDS.novox_mesh-mail_send",
|
"$JS.API.CONSUMER.INFO.MAIL_SENDS.novox_mesh-mail_send",
|
||||||
"$JS.API.CONSUMER.MSG.NEXT.MAIL_SENDS.novox_mesh-mail_send",
|
"$JS.API.CONSUMER.MSG.NEXT.MAIL_SENDS.novox_mesh-mail_send",
|
||||||
"$JS.ACK.MAIL_SENDS.novox_mesh-mail_send.x",
|
"$JS.API.DIRECT.GET.KV_mesh-mail_sends.>",
|
||||||
"$KV.mesh-mail_sends.x",
|
"$JS.API.DIRECT.GET.KV_messenger_asks.$KV.messenger_asks.mesh-mail.>",
|
||||||
"$JS.API.DIRECT.GET.KV_mesh-mail_sends.$KV.mesh-mail_sends.x",
|
"$JS.API.STREAM.INFO.KV_mesh-mail_sends",
|
||||||
"$JS.API.DIRECT.GET.KV_messenger_asks.$KV.messenger_asks.mesh-mail.a1",
|
"$JS.FC.KV_mesh-mail_sends.>",
|
||||||
"mesh.seat.operator-channel.tool.tell",
|
"$KV.mesh-mail_sends.>",
|
||||||
|
"mesh.mod.mesh-mail.event.mail.send.failed",
|
||||||
|
"mesh.mod.mesh-mail.event.mail.send.sent",
|
||||||
|
"mesh.seat.operator-channel.call.tell.*.novox~mesh-mail~send",
|
||||||
"mesh.seat.operator-channel.call.tell.novox~mesh-mail~send",
|
"mesh.seat.operator-channel.call.tell.novox~mesh-mail~send",
|
||||||
} {
|
"mesh.seat.operator-channel.tool.tell",
|
||||||
if !allowed(got.Publish, s) {
|
"mesh.seat.operator-channel.tool.tell.*",
|
||||||
t.Errorf("the process may not publish %s", s)
|
}
|
||||||
}
|
pub := append([]string(nil), got.Publish...)
|
||||||
|
sort.Strings(pub)
|
||||||
|
want := append([]string(nil), wantPublish...)
|
||||||
|
sort.Strings(want)
|
||||||
|
if !slices.Equal(pub, want) {
|
||||||
|
t.Fatalf("the process's whole publish set:\n%v\nwant exactly:\n%v", pub, want)
|
||||||
}
|
}
|
||||||
if !allowed(got.Subscribe, "_INBOX.novox.mesh-mail.send.x") {
|
if !allowed(got.Subscribe, "_INBOX.novox.mesh-mail.send.x") {
|
||||||
t.Error("the process does not hear its own inbox")
|
t.Error("the process does not hear its own inbox")
|
||||||
|
|||||||
Reference in New Issue
Block a user