diff --git a/modules/mesh-delivery-builder/cmd/mesh-delivery-builder/reserve_test.go b/modules/mesh-delivery-builder/cmd/mesh-delivery-builder/reserve_test.go index c12e547a3..0144304dc 100644 --- a/modules/mesh-delivery-builder/cmd/mesh-delivery-builder/reserve_test.go +++ b/modules/mesh-delivery-builder/cmd/mesh-delivery-builder/reserve_test.go @@ -495,7 +495,7 @@ func TestABuiltReservationIsTakenInFromItsState(t *testing.T) { if !slices.Equal(said, []string{"look:a@" + v.Version + " sha256:looka"}) || !slices.Equal(asked, []string{"look " + v.Version}) { t.Errorf("at a look: said %v, publish items asked %v; want look:a's package-published said and its item asked", said, asked) } - if ends := boundEnds("look"); !ends.Equal(v.BuiltAt.Add(defaultPublishAckMinutes*time.Minute)) { + if ends := boundEnds("look"); !ends.Equal(v.BuiltAt.Add(defaultPublishAckMinutes * time.Minute)) { t.Errorf("the bound armed at a look ends %v, want %v: counted from the build's end", ends, v.BuiltAt.Add(defaultPublishAckMinutes*time.Minute)) } if cur, _, _ := rv.r.Of(ctx, "look", v.Version); len(cur.Kept) != 0 || !cur.Published["look:a"] { diff --git a/modules/mesh-delivery-pipeline/cmd/mesh-delivery-pipeline/held_integration_test.go b/modules/mesh-delivery-pipeline/cmd/mesh-delivery-pipeline/held_integration_test.go index 8a573a05b..26fe7fe4a 100644 --- a/modules/mesh-delivery-pipeline/cmd/mesh-delivery-pipeline/held_integration_test.go +++ b/modules/mesh-delivery-pipeline/cmd/mesh-delivery-pipeline/held_integration_test.go @@ -35,7 +35,8 @@ func testASupersededBuildIsPassedOverOrHeldAndItsWaitEnds(t *testing.T) { w := startWhole(t, ctx, []catalog.Registration{reg}, func(raw []byte) catalog.RevisionAnswer { var in catalog.RevisionInput _ = json.Unmarshal(raw, &in) - if nine.Load() && (in.Revision == 9 || in.Revision == 0) { + // A revision the catalog keeps answers as itself: a read naming 9 is answered 9 from the start; only the newest follows nine. + if in.Revision == 9 || (nine.Load() && in.Revision == 0) { return catalog.RevisionAnswer{Revision: &catalog.CatalogRevision{Revision: 9, Kind: "trunk", Branch: "main", Source: 9}, Entries: []catalog.CatalogEntry{{Module: "app", Commit: "c1", Fp: "src2:a9"}}} } @@ -93,9 +94,19 @@ func testASupersededBuildIsPassedOverOrHeldAndItsWaitEnds(t *testing.T) { return readPipeline(ctx, w.pipelines, key, &p) && stepOf(p, seat.StepResultStepBuild).Ask != first }) again := stepOf(p, seat.StepResultStepBuild) - mu.Lock() - last := started[len(started)-1] - mu.Unlock() + // The runner says the step-started after the write: wait for the one with rerun. + var last seat.StepEvent + waitFor(t, ctx, w.logs, func() bool { + mu.Lock() + defer mu.Unlock() + for _, ev := range started { + if ev.Result.Rerun && ev.Result.Ask == again.Ask { + last = ev + return true + } + } + return false + }) if again.Outcome != seat.StepResultOutcomeRunning || !again.Rerun || len(p.Superseded) != 0 || !last.Result.Rerun || last.Result.By != "mesh-delivery-pipeline" || last.Result.Ask != again.Ask { t.Fatalf("a superseded end naming an older revision left %+v, superseded %v, last step-started %+v; want the build asked again as a rerun by the runner, the mover staying", again, p.Superseded, last) }