Hold the controller walk's key in the own-path test and read its walk again before ending it (issue 1931)
This commit is contained in:
@@ -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
|
// 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.
|
// walk, is not folded into it, and its word is taken meanwhile: it starts once the own-path walk ended.
|
||||||
catalogueWalk := ws[0]
|
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))
|
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))
|
cutAt(t, open, t0.Add(6*time.Minute))
|
||||||
ws, _ = walks(t, open)
|
ws, _ = walks(t, open)
|
||||||
@@ -659,7 +667,11 @@ func TestAMergeOnTheControllersPathNeverSharesABatch(t *testing.T) {
|
|||||||
if len(*asked) != before {
|
if len(*asked) != before {
|
||||||
t.Fatalf("the catalogue walk started beside the controller's: asked %v", (*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
|
own2.State = inventory.PlanDone
|
||||||
if err := open.inventory.SavePlan(ctx, &own2); err != nil {
|
if err := open.inventory.SavePlan(ctx, &own2); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|||||||
Reference in New Issue
Block a user