On 2026-10-30 mesh-catalog #571 joined fix/held-module-and-assigner-contract at 21:59; the group stayed checking, so mesh/delivery-group kept saying "3 of 3 member(s) ready" for a group of four, and #571 had no mesh/delivery-group status until the state changed. Quick fix: compare the why too. Thorough fix: compare the why and the member ids (each names its head), so a push that keeps the count is said as well. Chose thorough: same size, covers the push case.
36 lines
1.6 KiB
Go
36 lines
1.6 KiB
Go
package main
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// A member that joins a group whose state stays checking is said on mesh/delivery-group, and the members already there
|
|
// read the new count: on 2026-10-30 mesh-catalog #571 joined a group of three at 21:59, and the forge kept saying
|
|
// "3 of 3 member(s) ready" of the group of four, since the line was written again only when the state changed.
|
|
func TestAGroupSaysAJoiningMember(t *testing.T) {
|
|
w := newWorld(t)
|
|
const ctlHead, catHead, hostHead = "c1c1c1c1c1c1c1c1", "d2d2d2d2d2d2d2d2", "e3e3e3e3e3e3e3e3"
|
|
w.h.PullUpdated(pr("novox/mesh-controller", 1, ctlHead, "feat/x", "internal/a.go"))
|
|
w.h.PullUpdated(pr("novox/mesh-catalog", 2, catHead, "feat/x", "modules/app/module.json"))
|
|
w.h.Checked(verdict("novox/mesh-controller", 1, ctlHead, "pass"))
|
|
w.settleAll()
|
|
first := w.forge.statuses["novox/mesh-controller@"+ctlHead+" mesh/delivery-group"]
|
|
if !strings.Contains(first, "1 of 2") {
|
|
t.Fatalf("before the join the group says %q, want 1 of 2", first)
|
|
}
|
|
w.h.PullUpdated(pr("novox/mesh-host", 3, hostHead, "feat/x", "cmd/a.go"))
|
|
w.settleAll()
|
|
g := w.h.groups["feat/x"]
|
|
st, why := GroupState(g, w.h.membersOf(g))
|
|
for _, c := range []struct{ name, key, want string }{
|
|
{"a member already there", "novox/mesh-controller@" + ctlHead, "1 of 3"},
|
|
{"the member that joined", "novox/mesh-host@" + hostHead, "1 of 3"},
|
|
} {
|
|
s := w.forge.statuses[c.key+" mesh/delivery-group"]
|
|
if !strings.Contains(s, c.want) {
|
|
t.Errorf("%s: mesh/delivery-group says %q while the group is %s (%s); want %q", c.name, s, st, why, c.want)
|
|
}
|
|
}
|
|
}
|