diff --git a/modules/mesh-delivery-sdk/steprun/conformance/conformance.go b/modules/mesh-delivery-sdk/steprun/conformance/conformance.go index 2338afa1..e3f8ade3 100644 --- a/modules/mesh-delivery-sdk/steprun/conformance/conformance.go +++ b/modules/mesh-delivery-sdk/steprun/conformance/conformance.go @@ -291,7 +291,7 @@ func StepEnds(t *testing.T, steps steprun.AskSteps) { } } -// RunsCounted is the case every build module runs on its puller (A-489a): the poison rule and a transport fault's run count the +// A-489c: RunsCounted is the case every build module runs on its puller (A-489a): the poison rule and a transport fault's run count the // runs the module's steps state says started, so the puller is built with Prior over the module's own read of that state. The // module builds its puller with read as its steps state's read; a step key it holds with a started run must count as that run. func RunsCounted(t *testing.T, puller func(read func(key string) (json.RawMessage, error)) *steprun.Puller) { diff --git a/modules/mesh-delivery-sdk/steprun/pull_poison_test.go b/modules/mesh-delivery-sdk/steprun/pull_poison_test.go index 974cb160..6ec823d4 100644 --- a/modules/mesh-delivery-sdk/steprun/pull_poison_test.go +++ b/modules/mesh-delivery-sdk/steprun/pull_poison_test.go @@ -136,10 +136,10 @@ func TestAnEndThatCannotBeWrittenIsGivenBack(t *testing.T) { } } -// A-489a: a refused run (Declining) and a dropped ask each say their pipeline step's end as could not +// A-489a: a decline at the take (a need the node lacks), a refused run (Declining) and a dropped ask each say their pipeline step's end as could not // run, naming its pipeline, and are acknowledged once it is written. func TestAnEndedPipelineStepIsSaidAndAcknowledged(t *testing.T) { - for _, c := range []string{"declined in its run", "dropped"} { + for _, c := range []string{"declined", "declined in its run", "dropped"} { t.Run(c, func(t *testing.T) { src, st := NewFakeAsks(), newSteps() a := sdkstep.StepAsk{ID: sdkstep.NewID(), Kind: sdkstep.AskStep, Language: sdkstep.AskGo, Asker: "mesh-delivery-pipeline", At: time.Now(), @@ -177,9 +177,20 @@ func TestAnEndedPipelineStepIsSaidAndAcknowledged(t *testing.T) { return nil, nil } } - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - go p.Pull(ctx) + if c == "declined" { + // The decoder refuses needs on a pipeline step ask, so no ask of the queue reaches the decline; the line is held + // by calling it with the ask built whole. + acked := 0 + p.decline(&Pulled{Ack: func() error { acked++; return nil }, Term: func() error { return nil }, Nak: func() error { return nil }}, a, []string{"node-build-node"}) + if acked != 1 { + t.Errorf("acked %d times, want once", acked) + } + src.Acked = append(src.Acked, "declined") + } else { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + go p.Pull(ctx) + } waitFor(t, "the end said", func() bool { mu.Lock(); defer mu.Unlock(); return len(ended) >= 1 }) waitFor(t, "the ask acknowledged", func() bool { ak, _, _ := src.Fates(); return len(ak) == 1 }) mu.Lock()