From 6e4bca7fce03f68c27d1ddd88b1d33bc716e7e22 Mon Sep 17 00:00:00 2001 From: jochen Date: Sat, 24 Oct 2026 21:48:30 +0200 Subject: [PATCH] Run the served rotation's verb on the bus chain the controller keeps, as its child process does (issue 1945) --- cmd/mesh-controller/composed_served_integration_test.go | 3 +++ internal/inventory/fortest.go | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/cmd/mesh-controller/composed_served_integration_test.go b/cmd/mesh-controller/composed_served_integration_test.go index c1d6a7a9..dce07570 100644 --- a/cmd/mesh-controller/composed_served_integration_test.go +++ b/cmd/mesh-controller/composed_served_integration_test.go @@ -460,6 +460,9 @@ func TestServedARotationRewritesOnlyTheCompositionsThatUseIt(t *testing.T) { before := map[string]map[string]uint64{"anchor": m.revisions(t, "anchor"), "laptop": m.revisions(t, "laptop")} holders, _ := m.open.inventory.HoldersOf(t.Context(), "postgres-database", "") var waited uint64 + // The verb runs here as its child process runs it: its inventory takes the chain from the bus the served controller keeps it + // on (the registrations and assignments are there), not the one in memory the fixture's store was made with. + inventory.OnTheBusChainForTest(t) said, err := capturedOutput(func() error { if err := rotateCommand(t.Context(), []string{"postgres-database"}); err != nil { return err diff --git a/internal/inventory/fortest.go b/internal/inventory/fortest.go index aac487fd..e9f6e985 100644 --- a/internal/inventory/fortest.go +++ b/internal/inventory/fortest.go @@ -208,3 +208,11 @@ func (i *Inventory) PlanValuesForTest(t *testing.T) map[string][]byte { } return out } + +// OnTheBusChainForTest makes an inventory opened from now on on the test's store take the chain from its opener (the bus), not +// the chain in memory the test made for the store: for a test that runs a verb in this process as the controller's child +// process runs it, over the bus the serving controller keeps the chain on. +func OnTheBusChainForTest(t *testing.T) { + t.Helper() + testChains.Delete(os.Getenv(store.Variable(Name))) +}