The held-merges integration test waits for the batch's window to close, as a joined batch's window opens again (issue 921)
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user