diff --git a/modules/mesh-delivery/cmd/mesh-delivery/bus_test.go b/modules/mesh-delivery/cmd/mesh-delivery/bus_test.go index f05fa263..34c5b329 100644 --- a/modules/mesh-delivery/cmd/mesh-delivery/bus_test.go +++ b/modules/mesh-delivery/cmd/mesh-delivery/bus_test.go @@ -582,16 +582,6 @@ func TestAPlanMovedCarryingAFailedBackupHoldsTheDeliveryWithTheBackupsWordsOverA const head, merge = "3333333333333333333333333333333333333333", "4444444444444444444444444444444444444444" announced := pr("novox/app", 9, head, "fix/y", "src/a.go") announced.BaseSHA = "t1t1t1t1t1t1" - b.publish(t, "mesh.mod.gitea.event.pull.updated", announced) - b.publish(t, "mesh.seat."+ControllerSeat+".event.checked", judgedAt("novox/app", 9, head, "pass", "t1t1t1t1t1t1")) - b.publish(t, "mesh.mod.gitea.event.pull.merged", merged("novox/app", 9, head, merge)) - - // Its walk runs, let go: the record names no failed backup yet. - now := time.Now() - walk := aWalk("plan-1", "novox/app", merge, true) - walk.Created, walk.State, walk.Revision = now, walkRolling, 1 - walk.Delivery.Go, walk.Delivery.By = &now, "mesh-delivery" - b.publish(t, "mesh.seat."+ControllerSeat+".event.plan-moved", walk) deliveryOf := func() Delivery { e, err := b.kvs["deliveries"].Get(context.Background(), kvKey(IDOf("novox/app", head))) var d Delivery @@ -600,6 +590,21 @@ func TestAPlanMovedCarryingAFailedBackupHoldsTheDeliveryWithTheBackupsWordsOverA } return d } + // Each event is published after the module has taken the one before it: they are on two subjects, and the runner + // may hand over a later one first, which the table would rightly judge on its own (merged before checked). + b.publish(t, "mesh.mod.gitea.event.pull.updated", announced) + rt.until("the pull request to be taken", 10*time.Second, func() bool { return deliveryOf().State != "" }) + b.publish(t, "mesh.seat."+ControllerSeat+".event.checked", judgedAt("novox/app", 9, head, "pass", "t1t1t1t1t1t1")) + rt.until("the verdict to be taken", 10*time.Second, func() bool { d := deliveryOf(); return d.State != "" && d.State != Proposed }) + b.publish(t, "mesh.mod.gitea.event.pull.merged", merged("novox/app", 9, head, merge)) + rt.until("the merge to be taken", 10*time.Second, func() bool { return deliveryOf().MergedAs != "" }) + + // Its walk runs, let go: the record names no failed backup yet. + now := time.Now() + walk := aWalk("plan-1", "novox/app", merge, true) + walk.Created, walk.State, walk.Revision = now, walkRolling, 1 + walk.Delivery.Go, walk.Delivery.By = &now, "mesh-delivery" + b.publish(t, "mesh.seat."+ControllerSeat+".event.plan-moved", walk) rt.until("the delivery to be delivering", 10*time.Second, func() bool { return deliveryOf().State == Delivering }) // A backup failed before the send: the delivery is held with the backup's words.