Keep the started walk started in the let-go test by holding its key, since a walk takes keys at once now (issue 1931)
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user