diff --git a/cmd/mesh-controller/batches_integration_test.go b/cmd/mesh-controller/batches_integration_test.go index 9a3a5e94..38c83a2b 100644 --- a/cmd/mesh-controller/batches_integration_test.go +++ b/cmd/mesh-controller/batches_integration_test.go @@ -641,6 +641,14 @@ func TestAMergeOnTheControllersPathNeverSharesABatch(t *testing.T) { // A catalogue walk waiting for its word when an own-path batch is cut keeps waiting beside the own-path // walk, is not folded into it, and its word is taken meanwhile: it starts once the own-path walk ended. catalogueWalk := ws[0] + // The controller's second walk keeps its key unbuilt, so it stays started as it did while its build ran; with the + // stand-in builder's key done at once one step would carry it to done and nothing would be beside the catalogue walk. + wholeKeys, held := openPlanKeys, &atomic.Bool{} + held.Store(true) + openPlanKeys = func() (planKeyReads, func(), error) { + all, done, err := wholeKeys() + return keysHolding{all, "mesh-controller", held, fpOfModuleAt("mesh-controller", "k2")}, done, err + } hear(t, open, repoMerge("mesh-controller", "k2", t0.Add(4*time.Minute)), t0.Add(4*time.Minute)) cutAt(t, open, t0.Add(6*time.Minute)) ws, _ = walks(t, open) @@ -659,7 +667,11 @@ func TestAMergeOnTheControllersPathNeverSharesABatch(t *testing.T) { if len(*asked) != before { t.Fatalf("the catalogue walk started beside the controller's: asked %v", (*asked)[before:]) } - own2 := ws[0] + // Read again: the step above wrote the walk (what its key waits for), so the copy read at its cut is stale. + own2, err := open.inventory.PlanByID(ctx, ws[0].ID) + if err != nil { + t.Fatal(err) + } own2.State = inventory.PlanDone if err := open.inventory.SavePlan(ctx, &own2); err != nil { t.Fatal(err)