From 2ba9eef58dfbed42ccdbeb260754b56aef9e5c72 Mon Sep 17 00:00:00 2001 From: jochen Date: Sat, 24 Oct 2026 04:12:07 +0200 Subject: [PATCH] Keep the started walk started in the let-go test by holding its key, since a walk takes keys at once now (issue 1931) --- cmd/mesh-controller/away_integration_test.go | 8 +++++--- cmd/mesh-controller/batches_integration_test.go | 9 +++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/cmd/mesh-controller/away_integration_test.go b/cmd/mesh-controller/away_integration_test.go index ff9a4c55..69099dc7 100644 --- a/cmd/mesh-controller/away_integration_test.go +++ b/cmd/mesh-controller/away_integration_test.go @@ -78,7 +78,7 @@ func TestAPlanGoesOnWithoutAMachineAwayWhenItsTierIsSent(t *testing.T) { holdB.Store(true) openPlanKeys = func() (planKeyReads, func(), error) { all, done, err := wholeKeys() - return keysHolding{all, "b", &holdB}, done, err + return keysHolding{all, "b", &holdB, ""}, done, err } digests := 0 wasSend := sendRollout @@ -226,15 +226,17 @@ func TestAPlanGoesOnWithoutAMachineAwayWhenItsTierIsSent(t *testing.T) { } } -// keysHolding is the stand-in builder's keys but for one module, whose key is not built while held. +// keysHolding is the stand-in builder's keys but for one module, whose key is not built while held; only the key of +// the fingerprint fp when that is given. type keysHolding struct { planKeyReads module string held *atomic.Bool + fp string } func (k keysHolding) Build(ctx context.Context, module, fp string) (builderkeys.Key, error) { - if module == k.module && k.held.Load() { + if module == k.module && k.held.Load() && (k.fp == "" || fp == k.fp) { return builderkeys.Key{Module: module, Fingerprint: fp}, nil } return k.planKeyReads.Build(ctx, module, fp) diff --git a/cmd/mesh-controller/batches_integration_test.go b/cmd/mesh-controller/batches_integration_test.go index 1a17a2f7..1c2ddec2 100644 --- a/cmd/mesh-controller/batches_integration_test.go +++ b/cmd/mesh-controller/batches_integration_test.go @@ -7,6 +7,7 @@ import ( "io" "os" "slices" + "sync/atomic" "strings" "testing" "time" @@ -512,6 +513,14 @@ func TestALateMergeOfAOneModuleRepositoryIsNamed(t *testing.T) { func TestAWalkLetGoBesideAStartedOneStartsOnceItEnded(t *testing.T) { open := windowed(t) asked := asksWithPaths(t) + // The started walk's key (one at c1) is not built, so that walk 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 other. + wholeKeys, held := openPlanKeys, &atomic.Bool{} + held.Store(true) + openPlanKeys = func() (planKeyReads, func(), error) { + all, done, err := wholeKeys() + return keysHolding{all, "one", held, fpOfModuleAt("one", "c1")}, done, err + } ctx := t.Context() hear(t, open, repoMerge("one", "c1", t0), t0) cutAt(t, open, t0.Add(2*time.Minute))