From ae105b4631b49e54fd243837f556332764570825 Mon Sep 17 00:00:00 2001 From: jochen Date: Tue, 17 Nov 2026 13:06:46 +0100 Subject: [PATCH] runner: test 109 reads a step's end said again from EVENTS through a durable consumer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../testruns_integration_test.go | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/modules/mesh-delivery-pipeline/cmd/mesh-delivery-pipeline/testruns_integration_test.go b/modules/mesh-delivery-pipeline/cmd/mesh-delivery-pipeline/testruns_integration_test.go index 5e13693f..7dd35123 100644 --- a/modules/mesh-delivery-pipeline/cmd/mesh-delivery-pipeline/testruns_integration_test.go +++ b/modules/mesh-delivery-pipeline/cmd/mesh-delivery-pipeline/testruns_integration_test.go @@ -82,6 +82,12 @@ func TestTestRunsAreAskedOncePerLevelAndMoveEveryReader(t *testing.T) { if _, err := events.CreateOrUpdateConsumer(ctx, jetstream.ConsumerConfig{Durable: "n1_" + module, AckPolicy: jetstream.AckExplicitPolicy}); err != nil { 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 { 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 { 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 { t.Errorf("the accepted step = %+v; want it accepted still", s) }