The node-engine's self-compose test lets no goroutine outlive a setting it reads (fix-a-bug-met-twice) #247

Merged
mesh-tools merged 3 commits from fix/47-H1-selfcompose-races into main 2026-11-21 22:07:14 +00:00
Showing only changes of commit ed8aa83475 - Show all commits
+8
View File
@@ -280,6 +280,14 @@ func TestTheNodeComposesItsWantsFromTheBus(t *testing.T) {
if err != nil {
t.Fatal(err)
}
// The composer's loop has ended (its out closed) before the test's cleanup restores composeAgain, laterAgain,
// passSaysEvery and slowAfter, which its passes read (fix-a-bug-met-twice: a goroutine outliving the setting it reads,
// as the shadows below).
defer func() {
cancel()
for range out {
}
}()
// oldie is placed and no want names it (a module at a build of the old form, nats on novox): the node runs it inside
// its own composition, and composes it there again, even before the agent has applied anything (Running empty).
oldie := `{"module":"oldie","version":"1","capabilities":["systemd"],"resources":[{"id":"service","type":"service","unit":"oldie.service","state":"running","boot":"enabled"}]}`