From 74efe8e2e7bc0fb8481b55875f73e668ed2315a9 Mon Sep 17 00:00:00 2001 From: jochen Date: Sat, 3 Oct 2026 23:15:57 +0200 Subject: [PATCH] Tests follow the grants and issue 203: a person may ask what answers; the resolver test mints its credential --- cmd/mesh-controller/network_test.go | 6 ++++++ internal/inventory/people_test.go | 11 +++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/cmd/mesh-controller/network_test.go b/cmd/mesh-controller/network_test.go index 6c76bed..adea345 100644 --- a/cmd/mesh-controller/network_test.go +++ b/cmd/mesh-controller/network_test.go @@ -266,6 +266,12 @@ func TestTheResolverIsToldEveryMachineOnTheNetworkAndToldAgainWhenOneLeaves(t *t if _, err := assign(ctx, open, "anchor", "dnsmasq"); err != nil { t.Fatal(err) } + // Its bus credential, as assigning issues it where the bus is reachable (novox/hq issue 203): + // no bus is known to this test, so it is minted here, or composing refuses the placeholder. + if _, err := open.inventory.MintBusPassword(ctx, inventory.BusUser{ + Username: "anchor.dnsmasq", Kind: inventory.BusModule, Node: "anchor", Module: "dnsmasq"}); err != nil { + t.Fatal(err) + } zones := func() string { t.Helper() for _, r := range composed(t, open, "anchor").Resources { diff --git a/internal/inventory/people_test.go b/internal/inventory/people_test.go index a3a4ac6..7df4b15 100644 --- a/internal/inventory/people_test.go +++ b/internal/inventory/people_test.go @@ -44,8 +44,15 @@ func TestAPersonMayCallToolsAndNothingElse(t *testing.T) { } // The one tool, both ways it is addressed (novox/hq ADR 0159): to whichever instance // answers, and to the instance on one machine. Nothing else. - if len(perms.Publish) != 2 || perms.Publish[0] != "mesh.mod.mesh-catalog.tool.catalog_tools" || - perms.Publish[1] != "mesh.mod.mesh-catalog.tool.catalog_tools.*" { + // And asking what answers (novox/hq ADR 0197), which claims nothing and calls nothing. + var tools []string + for _, s := range perms.Publish { + if !strings.HasPrefix(s, "$SRV.") { + tools = append(tools, s) + } + } + if len(tools) != 2 || tools[0] != "mesh.mod.mesh-catalog.tool.catalog_tools" || + tools[1] != "mesh.mod.mesh-catalog.tool.catalog_tools.*" { t.Errorf("ada may publish %v, which should be the one tool, both ways addressed, and nothing else", perms.Publish) } for _, s := range perms.Publish {