From fbf5a3f90941549807242c279307898640fc210c Mon Sep 17 00:00:00 2001 From: jochen Date: Sat, 17 Oct 2026 12:42:30 +0200 Subject: [PATCH] The held-merges integration test waits for the batch's window to close, as a joined batch's window opens again (issue 921) --- cmd/mesh-controller/merge_on_the_bus_test.go | 27 ++++++++++++-------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/cmd/mesh-controller/merge_on_the_bus_test.go b/cmd/mesh-controller/merge_on_the_bus_test.go index 2ebab58a..cc84fc3f 100644 --- a/cmd/mesh-controller/merge_on_the_bus_test.go +++ b/cmd/mesh-controller/merge_on_the_bus_test.go @@ -89,6 +89,13 @@ func TestMergesHeardWhileAnotherHolderHasThePlansAreRecordedAndCarried(t *testin was, wasPoll := inventory.HoldWaitFor, inventory.HoldPoll inventory.HoldWaitFor, inventory.HoldPoll = time.Second, 20*time.Millisecond t.Cleanup(func() { inventory.HoldWaitFor, inventory.HoldPoll = was, wasPoll }) + // A window of a second: a merge joining a batch opens its window again (ADR 0407 decision 1), so the batch the + // two held merges make is cut when that window has closed and the rollout before it has ended, not before. + settings := t.TempDir() + "/merge-window.json" + if err := os.WriteFile(settings, []byte(`{"merge-window": "1s", "merge-window-at-most": "10m"}`), 0o600); err != nil { + t.Fatal(err) + } + t.Setenv(mergeWindowFileVar, settings) publish := theMergePathOn(t, open) ctx := t.Context() @@ -119,16 +126,16 @@ func TestMergesHeardWhileAnotherHolderHasThePlansAreRecordedAndCarried(t *testin if err := open.inventory.SavePlan(ctx, &first); err != nil { t.Fatal(err) } - advanceHeld(ctx, open) // the rollout ended: the look that cuts what waited behind it - ws, bs := walks(t, open) - if len(bs) != 0 || len(ws) != 2 || ws[0].CommitOf("novox/one") != "c3" || len(ws[0].Delivery.Merges) != 2 { - t.Fatalf("the next rollout does not carry both merges: %d walk(s), batches %+v, merges %+v", len(ws), bs, - func() any { - if len(ws) > 0 && ws[0].Delivery != nil { - return ws[0].Delivery.Merges - } - return nil - }()) + // The rollout ended: the look that cuts what waited behind it, once the batch's window is closed too. + var bs []inventory.Plan + becomes(t, 15*time.Second, "the next rollout being cut with both merges", func() bool { + advanceHeld(ctx, open) + ws, bs = walks(t, open) + return len(bs) == 0 && len(ws) == 2 + }) + if ws[0].CommitOf("novox/one") != "c3" || len(ws[0].Delivery.Merges) != 2 { + t.Fatalf("the next rollout does not carry both merges: commit %q, merges %+v", ws[0].CommitOf("novox/one"), + ws[0].Delivery.Merges) } }