|
|
|
@@ -244,7 +244,7 @@ func TestTheNodeComposesItsWantsFromTheBus(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
// Issue 1126, the switch made safe: a bus not answering for a moment (a reload of its accounts) is tried again and
|
|
|
|
|
// refuses nothing; a pass whose run ended refuses nothing either.
|
|
|
|
|
composeAgain = []time.Duration{time.Millisecond, time.Millisecond, time.Millisecond}
|
|
|
|
|
setFor(t, &composeAgain, []time.Duration{time.Millisecond, time.Millisecond, time.Millisecond})
|
|
|
|
|
fresh := func(get func(context.Context, string, string) ([]byte, error)) (*Composer, *[]string) {
|
|
|
|
|
var refusals []string
|
|
|
|
|
e := b.env()
|
|
|
|
@@ -491,6 +491,14 @@ func TestTheNodeComposesItsWantsFromTheBus(t *testing.T) {
|
|
|
|
|
if composed != "" || !again.owed.Load() {
|
|
|
|
|
t.Errorf("%s: composed %v and owes a pass again %v; want nothing handed and a pass owed", row.name, composed != "", again.owed.Load())
|
|
|
|
|
}
|
|
|
|
|
// Then the catalogue no longer places the node: it composes nothing of its own, and owes no pass either, so
|
|
|
|
|
// no timer is armed again (rev-seed-same-3, round 1).
|
|
|
|
|
again.mu.Lock()
|
|
|
|
|
clear(again.placements)
|
|
|
|
|
again.mu.Unlock()
|
|
|
|
|
if again.compose(ctx); again.owed.Load() {
|
|
|
|
|
t.Errorf("%s: an unplaced node still owes a pass", row.name)
|
|
|
|
|
}
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
if composed == "" {
|
|
|
|
@@ -837,7 +845,7 @@ func TestTheNodeComposesItsWantsFromTheBus(t *testing.T) {
|
|
|
|
|
t.Errorf("what runs moved, and %d answer(s) were composed again for %d group(s)", got-settled, len(answers))
|
|
|
|
|
}
|
|
|
|
|
// A read the bus did not answer is no answer to keep: the group is answered again after a bound, though nothing moved.
|
|
|
|
|
laterAgain = []time.Duration{20 * time.Millisecond}
|
|
|
|
|
setFor(t, &laterAgain, []time.Duration{20 * time.Millisecond})
|
|
|
|
|
ownFails.Store(true)
|
|
|
|
|
candidate("adds", 9, "lemurs", "keeper")
|
|
|
|
|
waitFor("the answer met the vault not answering", func(a map[string]delivery.CandidateAnswer) bool {
|
|
|
|
@@ -903,7 +911,7 @@ func TestTheNodeComposesItsWantsFromTheBus(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
// Issue 1126, the shadow shows its work: one input not read after the wait is said, naming it, in the journal and in
|
|
|
|
|
// a refused answer to each group known; once read, the group is answered for real.
|
|
|
|
|
notReadyAfter = 30 * time.Millisecond
|
|
|
|
|
setFor(t, ¬ReadyAfter, 30*time.Millisecond)
|
|
|
|
|
nb := newPatternBus()
|
|
|
|
|
nenv := readOnly.env()
|
|
|
|
|
nenv.Watch = nb.watch
|
|
|
|
@@ -948,8 +956,7 @@ func TestTheNodeComposesItsWantsFromTheBus(t *testing.T) {
|
|
|
|
|
t.Errorf("a shadow not ready said %q", nsaid)
|
|
|
|
|
}
|
|
|
|
|
nmu.Unlock()
|
|
|
|
|
slowAfter = time.Nanosecond // every answer is slow: said, and noted in words that do not move with the time
|
|
|
|
|
defer func() { slowAfter = time.Minute }()
|
|
|
|
|
setFor(t, &slowAfter, time.Nanosecond) // every answer is slow: said, and noted in words that do not move with the time
|
|
|
|
|
nb.send(delivery.AssignerWantsBucket, agent.Update{Caught: true})
|
|
|
|
|
select {
|
|
|
|
|
case a := <-nanswered:
|
|
|
|
@@ -1310,3 +1317,12 @@ func TestAHaveSaysWhetherItsModuleRunsInsideTheNodesOwn(t *testing.T) {
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// setFor sets a package global (a wait the composer or the shadow reads) for one test, and puts back what it held when
|
|
|
|
|
// the test ends, so no later test runs on another test's waits.
|
|
|
|
|
func setFor[T any](t *testing.T, p *T, v T) {
|
|
|
|
|
t.Helper()
|
|
|
|
|
old := *p
|
|
|
|
|
*p = v
|
|
|
|
|
t.Cleanup(func() { *p = old })
|
|
|
|
|
}
|
|
|
|
|