node-tools: every wait on the bus in a test waits the shared bound, not a few seconds (issue 1754)

TestAStaleWriteIsRefusedAndWritesNothing gave the watch 5 s to hear a 1 s
key's expire and failed main.505's integration step on a loaded build node;
TestARunnerAtItsStopAnswersNoCallAndItsCallersMeetNoResponders failed its
rerun while it asked 1 s of two round trips and 5 s and 10 s of its waits.
The second of a kind after 3850eb8, so the kind is fixed: meshtest.Bound
(30 s, Until's bound, named once) is what every node-tools test that starts
a bus waits for what the bus carries; Until becomes a deadline of it, so a
try that waits does not multiply it; an upper bound on how long a call or a
wait took is half the bound it tells apart (bus.RequestTimeout, the call's
or the wait's own), at most meshtest.Bound. A wait that hears ends then: no
passing test is longer (per-test durations before and after, equal).

A guard (meshtest waits_test.go) reads every test file that imports
meshtest and refuses a wait whose constant bound is a second or more under
meshtest.Bound; it names 34 such waits at 309069de.

Builds: issue 1754 note 8 (the quick fix), note 9 (1754/AC1 to AC4); principle 11
This commit is contained in:
2026-11-23 19:21:28 +01:00
parent 309069dec1
commit 6a1b4817f8
23 changed files with 309 additions and 72 deletions
@@ -138,8 +138,8 @@ func TestTheToolRunnerStartedByItsEntryServesABundleOverTheSeatListItReads(t *te
if err != nil {
t.Errorf("serve ended with %v", err)
}
case <-time.After(30 * time.Second):
t.Error("the tool runner did not stop within 30s")
case <-time.After(mt.Bound):
t.Errorf("the tool runner did not stop within %s", mt.Bound)
}
})
}
@@ -167,7 +167,7 @@ func TestTheToolRunnerStartedByItsEntryServesABundleOverTheSeatListItReads(t *te
if _, err := ask("seat:node-desk.slow@anchor"); err == nil {
t.Error("the verb that answers after three seconds was answered within its timeout of one second")
}
if took := time.Since(began); took < time.Second || took > 2500*time.Millisecond {
if took := time.Since(began); took < time.Second || took > bus.RequestTimeout/2 { // 1754/AC4
t.Errorf("the verb of a timeout of one second was waited %s, want about one second, not the runner's own %s", took, bus.RequestTimeout)
}
@@ -199,7 +199,7 @@ func TestTheToolRunnerStartedByItsEntryServesABundleOverTheSeatListItReads(t *te
}
readPage := func(cursor string) paged {
t.Helper()
answered, err := asker.AskWithin("ledger.page", map[string]any{"cursor": cursor}, "", 30*time.Second)
answered, err := asker.AskWithin("ledger.page", map[string]any{"cursor": cursor}, "", mt.Bound)
var p paged
if err != nil || json.Unmarshal(answered.Result, &p) != nil || p.Error != nil {
t.Fatalf("the page after %q was answered %.300s, %v", cursor, answered.Result, err)