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.
63 lines
2.5 KiB
Go
63 lines
2.5 KiB
Go
package main
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
// R6-C4 (ADR 0539 §17): the delivery's status and view say the merge's six states and nothing after the merge: no delivery plan,
|
|
// no machine step, no covered or walk line; a merged delivery's view names the source revision its merge moved.
|
|
func TestStatusAndViewSayEachOfTheSixStatesWithNoPlanAndNoMachineStep(t *testing.T) {
|
|
at := time.Date(2026, 10, 24, 12, 0, 0, 0, time.UTC)
|
|
base := Delivery{ID: "novox/app@c0ffee000000", Repository: "novox/app", Commit: "c0ffee000000", Number: 7, Since: at,
|
|
Transitions: []Transition{{At: at, From: Proposed, To: Rejected, Event: EvRefused, Why: "the gate said fail"}}}
|
|
for _, c := range []struct {
|
|
state State
|
|
mutate func(d *Delivery)
|
|
status string
|
|
desc string
|
|
inView []string
|
|
keepOut []string
|
|
}{
|
|
{Proposed, nil, "pending", "checking", nil, nil},
|
|
{Ready, nil, "success", "ready: it is merged on the Approve", nil, nil},
|
|
{Rejected, nil, "failure", "rejected: the gate said fail", nil, nil},
|
|
{Merged, func(d *Delivery) { d.MergedAs = "bbbbbbbbbbbb1111" }, "success",
|
|
"merged: source.main moved to novox/app@bbbbbbbbbbbb", []string{"**Source**", "source.main moved to novox/app@bbbbbbbbbbbb", "mesh-delivery-view"}, nil},
|
|
{Held, func(d *Delivery) { d.MergedAs, d.HeldWhy = "bbbbbbbbbbbb1111", "merged without a passing check" }, "pending",
|
|
"held for a person: merged without a passing check", []string{"Held for a person: merged without a passing check"}, nil},
|
|
{Closed, nil, "warning", "closed: the gate said fail", nil, nil},
|
|
} {
|
|
d := base
|
|
d.State = c.state
|
|
if c.mutate != nil {
|
|
c.mutate(&d)
|
|
}
|
|
state, desc := statusOf(&d)
|
|
if state != c.status || desc != c.desc {
|
|
t.Errorf("%s: the status is %s %q, wanted %s %q", c.state, state, desc, c.status, c.desc)
|
|
}
|
|
view := ViewBody(&d, nil)
|
|
if !strings.Contains(view, "**"+string(c.state)+"**") {
|
|
t.Errorf("%s: the view does not say the state: %s", c.state, view)
|
|
}
|
|
for _, want := range c.inView {
|
|
if !strings.Contains(view, want) {
|
|
t.Errorf("%s: the view lacks %q: %s", c.state, want, view)
|
|
}
|
|
}
|
|
for _, never := range []string{"**Delivery plan**", "**Machines**", "tier ", "receives", "walk", "Covered", "plans go", "mesh-delivery.release"} {
|
|
if strings.Contains(view, never) {
|
|
t.Errorf("%s: the view still says %q: %s", c.state, never, view)
|
|
}
|
|
}
|
|
}
|
|
// A merge not on the trunk names no source revision.
|
|
d := base
|
|
d.State = Merged
|
|
if s := d.sourceSaid(); s != "not on the trunk" {
|
|
t.Errorf("a merged delivery with no merge commit says %q", s)
|
|
}
|
|
}
|