The system-exports reload test waits for the event naming the user it connected, past the watchman's own (issue 1169)
mesh/merge-gate head ec85cdf70c07 merged into trunk cec26d859695 — pass: builds mesh-controller → novox; no bus step; every machine composes with the chang…
mesh/repo-check head ec85cdf70c07 merged into trunk cec26d859695 — pass: its merge-check.sh passed
mesh/delivery delivered

This commit is contained in:
2026-10-19 01:06:56 +02:00
parent cd303f68ed
commit ec85cdf70c
+14 -6
View File
@@ -104,15 +104,23 @@ func TestNatsTheSystemAccountsExportsReachMeshOnAReload(t *testing.T) { // 1147/
} }
// Another user connects and disconnects: the watchman hears both, and the events name that user. // Another user connects and disconnects: the watchman hears both, and the events name that user.
gitea, _ := connect("one.gitea") gitea, _ := connect("one.gitea")
// The server says each connection's own events too, the watchman's among them, and may say its connect after the
// subscription is made (issue 1169): the event looked for is the one naming the other user, whatever comes before it.
hears := func(ch chan *nats.Msg, what string) { hears := func(ch chan *nats.Msg, what string) {
t.Helper() t.Helper()
select { bound := time.After(5 * time.Second)
case m := <-ch: var others []string
if !strings.Contains(string(m.Data), "one.gitea") { for {
t.Errorf("the %s event does not name the user that connected: %s", what, m.Data) select {
case m := <-ch:
if strings.Contains(string(m.Data), "one.gitea") {
return
}
others = append(others, string(m.Data))
case <-bound:
t.Errorf("the watchman did not hear another user's %s; it heard only %q", what, others)
return
} }
case <-time.After(5 * time.Second):
t.Errorf("the watchman did not hear another user's %s", what)
} }
} }
hears(connects, "connect") hears(connects, "connect")