Files
mesh-catalog/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/issue902_test.go
T
jschoubben 5ff337e0dc Gate keeps the merge's six states and asks the controller nothing (issue 1946, R6-C1, C2, C4)
Release 6 deletes the plans: the walk half of the holder, the controller port, the carry-over of the former module and the verbs times, what-if, release, stop and retire-history go; the table holds proposed, ready, rejected, merged, held and closed; the delivery's status and view name the source revision the merge moved.
2026-10-24 16:26:36 +02:00

66 lines
2.7 KiB
Go

package main
import (
"strings"
"testing"
)
// novox/hq issue 902: a group that is delivering passed its composed check for its members' heads, so
// mesh/delivery-group says success there; pending would keep its later members from ever merging.
func TestReplay902(t *testing.T) {
for state, want := range map[string]string{
"ready": "success", "merging": "success", "merged": "success",
"checking": "pending", "rejected": "failure", "held": "error", "closed": "error",
} {
if got := groupStatusState(state); got != want {
t.Errorf("a group %s says %s on mesh/delivery-group, want %s", state, got, want)
}
}
}
// group902 is a two-member group whose first member in its order merged.
func group902(t *testing.T) (*world, string, string, string, string) {
w := newWorld(t)
const ctlHead, catHead = "c1c1c1c1c1c1c1c1", "d2d2d2d2d2d2d2d2"
ctl, cat := IDOf("novox/mesh-controller", ctlHead), IDOf("novox/mesh-catalog", catHead)
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.h.Checked(verdict("novox/mesh-catalog", 2, catHead, "pass"))
w.settleAll()
w.h.Checked(CheckedEvent{Group: "feat/x", ID: "check-1", Verdict: "pass", Summary: "both compose"})
w.settleAll()
w.h.PullMerged(merged("novox/mesh-catalog", 2, catHead, "m2m2m2m2m2m2"))
w.settleAll()
return w, ctl, cat, ctlHead, catHead
}
func TestReplay902TheNextMemberOfADeliveringGroupReadsSuccess(t *testing.T) {
w, _, _, ctlHead, _ := group902(t)
g := w.h.groups["feat/x"]
st, _ := GroupState(g, w.h.membersOf(g))
s := w.forge.statuses["novox/mesh-controller@"+ctlHead+" mesh/delivery-group"]
t.Logf("state=%s status=%q", st, s)
if st != "merging" || !strings.HasPrefix(s, "success") {
t.Fatalf("want merging/success, got %s %q", st, s)
}
}
func TestReplay902AClosedGroupComposedAgainAndFailingSaysNoSuccess(t *testing.T) {
w, ctl, _, _, _ := group902(t)
const newHead = "e3e3e3e3e3e3e3e3"
_ = ctl
w.h.PullUpdated(pr("novox/mesh-controller", 1, newHead, "feat/x", "internal/a.go"))
w.h.Checked(verdict("novox/mesh-controller", 1, newHead, "pass"))
w.settleAll()
w.h.Checked(CheckedEvent{Group: "feat/x", ID: "check-2", Verdict: "fail", Summary: "no longer compose"})
w.settleAll()
g := w.h.groups["feat/x"]
st, why := GroupState(g, w.h.membersOf(g))
s := w.forge.statuses["novox/mesh-controller@"+newHead+" mesh/delivery-group"]
t.Logf("closed=%v check=%+v state=%s (%s) status=%q", g.Closed, g.Check, st, why, s)
if strings.HasPrefix(s, "success") {
t.Fatalf("a closed group whose composed check failed for its heads says success: %q", s)
}
}