assigner: a case holding that a take-up says an end again under the open run's ask, a first end under the ask's id (A-470q)
Builds: design 47 G §719; A-470q.
This commit is contained in:
@@ -1,8 +1,10 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"maps"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"slices"
|
"slices"
|
||||||
@@ -601,6 +603,30 @@ func TestACompositionRunsBoundTimesOwedProgress(t *testing.T) {
|
|||||||
if keys, _ := r.keysOf("main.3", "a"); !slices.Equal(keys, []string{runKeyOf("main.3", "n1"), runKeyOf("main.3", "n2")}) {
|
if keys, _ := r.keysOf("main.3", "a"); !slices.Equal(keys, []string{runKeyOf("main.3", "n1"), runKeyOf("main.3", "n2")}) {
|
||||||
t.Errorf("the runs of reader a: %v", keys)
|
t.Errorf("the runs of reader a: %v", keys)
|
||||||
}
|
}
|
||||||
|
// A-470q: a reader with no `ended` says its first end under its ask's id; d, marked rerun, says its end again under
|
||||||
|
// `<id>.<the open run's ask>`.
|
||||||
|
ids := make(chan [2]string, 3)
|
||||||
|
steps := &compositionSteps{node: "n1", now: func() time.Time { return now }, logf: t.Logf,
|
||||||
|
resume: func(context.Context, string, meshwants.StepRun) stepOutcome {
|
||||||
|
return stepOutcome{Outcome: meshwants.StepEndedOutcomePassed}
|
||||||
|
},
|
||||||
|
say: func(_ string, body any, id string) error {
|
||||||
|
ids <- [2]string{body.(meshwants.StepEnded).ID, id}
|
||||||
|
return nil
|
||||||
|
}}
|
||||||
|
steps.takeUp(context.Background(), r)
|
||||||
|
got := map[string]string{}
|
||||||
|
for range 3 {
|
||||||
|
select {
|
||||||
|
case e := <-ids:
|
||||||
|
got[e[0]] = e[1]
|
||||||
|
case <-time.After(5 * time.Second):
|
||||||
|
t.Fatalf("the ends of the take-up: %v", got)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if want := map[string]string{"a": "a", "b": "b", "d": "d.run-n1"}; !maps.Equal(got, want) {
|
||||||
|
t.Errorf("the message ids of the take-up's ends: %v, want %v", got, want)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user