steprun: the decline of a pipeline step is held by a test; RunsCounted cites A-489c
Builds: design 47 G §24; lead answers A-489a, A-489c Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user