Wait for a stopped bundle's exit instead of sleeping after it
mesh/delivery delivered
mesh/merge-gate pass: builds mesh-tools, node-tools → ace, g14, novox, shanks; no bus step; every machine composes with the change as it did without (4 of …
mesh/repo-check pass: its merge-check.sh passed

Launched.Stop now returns once the bundle's exit is handled, bounded by
StopWait, and the launcher reads its restart pauses once at Start, so
the exit goroutine no longer races a test that changes them. The caller
tests drop their half-second pause (novox/hq issue 476).
This commit is contained in:
2026-10-12 10:43:22 +02:00
parent 172b5af589
commit 494d0787e2
2 changed files with 29 additions and 19 deletions
+2 -10
View File
@@ -27,7 +27,7 @@ func TestACallOnTheCallerNamedSubjectReachesTheModuleWithItsCaller(t *testing.T)
if err != nil {
t.Fatal(err)
}
defer settled(stop)
defer stop() // returns once the bundle's exit is handled (novox/hq issue 476)
asker, err := bus.Connect(bus.Credential{URL: mt.URL(t), Module: "node-tools", Node: "shanks",
User: "shanks.node-tools", Password: "unused"})
if err != nil {
@@ -65,7 +65,7 @@ func TestTheSubjectThatNamesNoCallerStillWorksAndNamesNone(t *testing.T) {
if err != nil {
t.Fatal(err)
}
defer settled(stop)
defer stop() // returns once the bundle's exit is handled (novox/hq issue 476)
old, err := nats.Connect(mt.URL(t))
if err != nil {
t.Fatal(err)
@@ -89,11 +89,3 @@ func TestTheSubjectThatNamesNoCallerStillWorksAndNamesNone(t *testing.T) {
}
}
}
// settled stops a runtime and waits for its bundle's exit to be handled: the launcher reads its restart pauses
// (launch.RestartFirst) as a bundle exits, and a later test in this package sets them, so a test that leaves its
// bundle exiting behind it races the next one.
func settled(stop func()) {
stop()
time.Sleep(500 * time.Millisecond)
}