B2 revision-wait-said: the runner's build step test hears wait-held on revision:<R> and wait-ended ran from the bus

Builds: design 47 H2 H-A-577 (1) (AC-B2)
This commit is contained in:
2026-11-25 19:32:40 +01:00
parent 250713ecf4
commit ec00d887c0
@@ -68,6 +68,33 @@ func TestTheRunnersBuildStepAskIsAnsweredAsStepEnded(t *testing.T) {
case <-time.After(20 * time.Second):
t.Fatal("no step-ended within 20 s")
}
// Design 47 H2 H-A-577 (1), AC-B2: an ask whose revision the picture does not hold says wait-held (step build, on revision:<R>, kept
// under <module>.<fingerprint>.revision) and wait-ended with how ran once it does.
waits := make(chan *nats.Msg, 8)
for _, ev := range []string{"wait-held", "wait-ended"} {
w, err := sub.ChanSubscribe("mesh.mod.*.event."+ev+".netcheck.>", waits)
if err != nil {
t.Fatal(err)
}
defer w.Unsubscribe()
}
revisionWait := func(event string) waitBody {
t.Helper()
for bound := time.After(20 * time.Second); ; {
select {
case m := <-waits:
var w waitBody
if err := json.Unmarshal(m.Data, &w); err != nil {
t.Fatal(err)
}
if strings.Contains(m.Subject, ".event."+event+".") && strings.HasSuffix(m.Subject, ".revision") {
return w
}
case <-bound:
t.Fatalf("no %s of the revision wait within 20 s", event)
}
}
}
// H-A-155: an ask naming a source revision the builder's picture of main does not hold yet waits for it, said in the
// journal, and is answered once a revision taken in from it arrives.
run.Pipeline, run.Revision, run.Source = "main.2.netcheck", 2, 2
@@ -79,6 +106,9 @@ func TestTheRunnersBuildStepAskIsAnsweredAsStepEnded(t *testing.T) {
t.Fatal(err)
}
b.awaitSaid(t, "main.2.netcheck: revision 2 of main not in the builder's picture yet")
if w := revisionWait("wait-held"); w.On != "revision:2" || w.Step != "build" || w.Module != "netcheck" || w.Fingerprint != fp {
t.Errorf("wait-held of the ask for revision 2 = %+v, want step build, on revision:2, netcheck at %s", w, fp)
}
b.catalog.mu.Lock()
b.catalog.source = 2
b.catalog.mu.Unlock()
@@ -93,6 +123,9 @@ func TestTheRunnersBuildStepAskIsAnsweredAsStepEnded(t *testing.T) {
case <-time.After(20 * time.Second):
t.Fatal("no step-ended for ask-2 within 20 s")
}
if w := revisionWait("wait-ended"); w.On != "revision:2" || w.How != "ran" {
t.Errorf("wait-ended of the ask for revision 2 = %+v, want on revision:2 ended ran", w)
}
// Each ask is acknowledged once its end was said: the seat's worker holds none pending.
stream, worker := buscompose.SeatQueueStreamName(meshbuilds.Seat), buscompose.SeatQueueWorkerName(meshbuilds.Seat)
deadline := time.Now().Add(10 * time.Second)