runner: test 109 reads a step's end said again from EVENTS through a durable consumer

The runner keeps no message id on its step events (A-470t), so the bus's deduplication drops no end
said again (A-470q); test 109 now reads the tools' unit step-ended from the stream through a durable
consumer, its first end failed and the end said again by the move passed, both kept.

Builds: design 47 G §727; A-470d, A-470q, A-470t
This commit is contained in:
2026-11-17 13:06:46 +01:00
parent 533a076eb3
commit ae105b4631
@@ -82,6 +82,12 @@ func TestTestRunsAreAskedOncePerLevelAndMoveEveryReader(t *testing.T) {
if _, err := events.CreateOrUpdateConsumer(ctx, jetstream.ConsumerConfig{Durable: "n1_" + module, AckPolicy: jetstream.AckExplicitPolicy}); err != nil { if _, err := events.CreateOrUpdateConsumer(ctx, jetstream.ConsumerConfig{Durable: "n1_" + module, AckPolicy: jetstream.AckExplicitPolicy}); err != nil {
t.Fatal(err) t.Fatal(err)
} }
// A durable consumer of the runner's step-ended in EVENTS, so an end said again is read as the stream keeps it (A-470q).
stepEnds, err := events.CreateOrUpdateConsumer(ctx, jetstream.ConsumerConfig{Durable: "t109-step-ended",
FilterSubject: "mesh.seat." + seat.Seat + ".event." + seat.EventStepEnded + ".>", AckPolicy: jetstream.AckExplicitPolicy})
if err != nil {
t.Fatal(err)
}
if _, err := js.CreateStream(ctx, jetstream.StreamConfig{Name: "ASKS", Subjects: []string{"mesh.seat.*.accept.>"}, Retention: jetstream.WorkQueuePolicy}); err != nil { if _, err := js.CreateStream(ctx, jetstream.StreamConfig{Name: "ASKS", Subjects: []string{"mesh.seat.*.accept.>"}, Retention: jetstream.WorkQueuePolicy}); err != nil {
t.Fatal(err) t.Fatal(err)
} }
@@ -422,6 +428,29 @@ func TestTestRunsAreAskedOncePerLevelAndMoveEveryReader(t *testing.T) {
if s := step(p, "app:tools", "unit"); s.Outcome != seat.StepResultOutcomePassed || !s.Rerun { if s := step(p, "app:tools", "unit"); s.Outcome != seat.StepResultOutcomePassed || !s.Rerun {
t.Errorf("the tools' unit step = %+v; want moved to passed, marked a rerun", s) t.Errorf("the tools' unit step = %+v; want moved to passed, marked a rerun", s)
} }
// The tools' unit step's ends, read from the stream: its first, failed, and its end said again by the move, passed.
var toolEnds []string
for {
batch, err := stepEnds.FetchNoWait(100)
if err != nil {
t.Fatal(err)
}
n := 0
for m := range batch.Messages() {
n++
var e seat.StepEvent
if json.Unmarshal(m.Data(), &e) == nil && e.Pipeline == p3 && e.Result.Artifact == "app:tools" && e.Result.Step == "unit" {
toolEnds = append(toolEnds, e.Result.Outcome)
}
_ = m.Ack()
}
if n == 0 {
break
}
}
if len(toolEnds) < 2 || toolEnds[0] != seat.StepResultOutcomeFailed || toolEnds[len(toolEnds)-1] != seat.StepResultOutcomePassed {
t.Errorf("the tools' unit step-ended in EVENTS = %v; want its first end failed and the end said again passed, both kept", toolEnds)
}
if s := step(p, "app:program", "integration"); s.Outcome != seat.StepResultOutcomeAccepted { if s := step(p, "app:program", "integration"); s.Outcome != seat.StepResultOutcomeAccepted {
t.Errorf("the accepted step = %+v; want it accepted still", s) t.Errorf("the accepted step = %+v; want it accepted still", s)
} }