mesh/merge-gate head 8efe499db965 merged into trunk 173c5d5ef434 — pass: builds mesh-delivery → novox; no bus step; every machine composes with the change …
mesh/repo-check head 8efe499db965 merged into trunk 173c5d5ef434 — pass: its merge-check.sh passed, each part in its toolchain: merge-check.sh (go), merge-…
mesh/delivery delivered
68 lines
2.8 KiB
Go
68 lines
2.8 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", "delivering": "success", "delivered": "success",
|
|
"checking": "pending", "rejected": "failure", "failed": "failure", "stopped": "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.ctl.order = func(ms []Member) Order { return Order{Order: []string{cat, ctl}} }
|
|
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 != "delivering" || !strings.HasPrefix(s, "success") {
|
|
t.Fatalf("want delivering/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()
|
|
t.Logf("checks asked: %v", w.ctl.checks)
|
|
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)
|
|
}
|
|
}
|