|
|
|
@@ -103,6 +103,21 @@ func TestARecordFollowsItsPipelineToTheMachines(t *testing.T) {
|
|
|
|
|
if _, ok := r.Entries[EntryKey("app", "f", "novox")]; ok {
|
|
|
|
|
t.Fatal("a removed want is an entry")
|
|
|
|
|
}
|
|
|
|
|
// Design 47 H2b §832 5. (1984/AC-832g, H-A-832, H-A-842): a want at a want-revision below the one held for that node and
|
|
|
|
|
// module changes nothing, a repeat of an applied body writes nothing new, and a field the contract does not know is
|
|
|
|
|
// left unread.
|
|
|
|
|
for _, w := range []string{
|
|
|
|
|
`{"v":1,"node":"ace","module":"app","fp":"f","pipeline":"main.1","source":1,"revision":12,"want-revision":9,"future":1}`,
|
|
|
|
|
`{"v":1,"node":"ace","module":"app","fp":"f2","pipeline":"main.1","source":1,"revision":12,"want-revision":8}`,
|
|
|
|
|
} {
|
|
|
|
|
hear(t, c, "mesh-wants.wanted.x.app", "", w)
|
|
|
|
|
}
|
|
|
|
|
if e, ok := r.Entries[EntryKey("app", "f", "ace")]; !ok || e.WantRevision != 9 {
|
|
|
|
|
t.Fatalf("the want at want-revision 9 is %+v: applied with its unknown field unread", e)
|
|
|
|
|
}
|
|
|
|
|
if _, ok := r.Entries[EntryKey("app", "f2", "ace")]; ok {
|
|
|
|
|
t.Fatal("a want at want-revision 8, below the 9 held, is an entry")
|
|
|
|
|
}
|
|
|
|
|
hear(t, c, "node-engine.running.ace.app", "ace", `{"v":1,"at":"2026-11-20T03:05:00Z","module":"app","node":"ace","fingerprint":"f","healthy":true}`)
|
|
|
|
|
hear(t, c, "node-engine.running.g14.app", "g14", `{"v":1,"at":"2026-11-20T03:05:00Z","module":"app","node":"g14","fingerprint":"f","healthy":true}`)
|
|
|
|
|
if o := r.Outcomes[OutcomeKey("app", "f", "g14", StepRunning)]; o.Outcome != OutcomeRunning || r.Ended != nil || len(*ended) != 0 {
|
|
|
|
@@ -112,6 +127,11 @@ func TestARecordFollowsItsPipelineToTheMachines(t *testing.T) {
|
|
|
|
|
if r.Ended == nil || r.Ended.Why != WhyAllRun || len(*ended) != 1 {
|
|
|
|
|
t.Fatalf("the record ended %+v, said %v", r.Ended, *ended)
|
|
|
|
|
}
|
|
|
|
|
// A tier-late said after the running changes nothing (1984/AC-832g).
|
|
|
|
|
hear(t, c, "mesh-wants.pipeline-wanted.main.1", "", `{"v":1,"pipeline":"main.1","branch":"main","source":1,"outcome":"tier-late","not-running":[{"module":"app","machines":["ace"]}]}`)
|
|
|
|
|
if r.Ended == nil || r.Ended.Why != WhyAllRun || len(*ended) != 1 {
|
|
|
|
|
t.Fatalf("the record ended %+v, said %v: a tier-late after the running changes nothing", r.Ended, *ended)
|
|
|
|
|
}
|
|
|
|
|
if got, _ := h.Records.ByKey("main", 1); got != r {
|
|
|
|
|
t.Fatal("the record read by its key is not the one the gate keeps")
|
|
|
|
|
}
|
|
|
|
@@ -405,20 +425,28 @@ func TestARecordsEndCountIsSaidAtEachEndAndAHigherPipelineEndReopensIt(t *testin
|
|
|
|
|
// GATE-5/AC (design 47 H §738, §751; H-A-75, H-A-89 (3), (4)): a pipeline-ended not passed ends the record failed naming
|
|
|
|
|
// the pipeline's why, and pipeline-wanted tier-late ends it failed naming the movers and machines not running.
|
|
|
|
|
func TestARecordEndsFailedOnAPipelineNotPassedOrATierLate(t *testing.T) {
|
|
|
|
|
for _, tc := range []struct{ name, key, body, why string }{
|
|
|
|
|
for _, tc := range []struct{ name, key, body, why, then string }{
|
|
|
|
|
{"pipeline failed", "mesh-pipeline-runner.pipeline-ended.main.1",
|
|
|
|
|
`{"v":1,"branch":"main","source":1,"pipeline":"main.1","outcome":"failed","why":"build failed","movers":[{"module":"app","fingerprint":"f","tier":1,"steps":[{"step":"build","status":"required","outcome":"failed"}]}]}`,
|
|
|
|
|
"failed: build failed"},
|
|
|
|
|
"failed: build failed", ""},
|
|
|
|
|
{"pipeline cancelled, no why", "mesh-pipeline-runner.pipeline-ended.main.1",
|
|
|
|
|
`{"v":1,"branch":"main","source":1,"pipeline":"main.1","outcome":"cancelled","movers":[]}`,
|
|
|
|
|
"failed: the pipeline main.1 ended cancelled"},
|
|
|
|
|
"failed: the pipeline main.1 ended cancelled", ""},
|
|
|
|
|
{"tier late", "mesh-wants.pipeline-wanted.main.1",
|
|
|
|
|
`{"v":1,"pipeline":"main.1","branch":"main","source":1,"outcome":"tier-late","not-running":[{"module":"app","machines":["g14","ace"]}]}`,
|
|
|
|
|
"failed: a tier is late: not running app on ace, g14"},
|
|
|
|
|
"failed: a tier is late: not running app on ace, g14", ""},
|
|
|
|
|
// 1984/AC-824f: a running after a tier-late leaves the record failed.
|
|
|
|
|
{"running after tier late", "mesh-wants.pipeline-wanted.main.1",
|
|
|
|
|
`{"v":1,"pipeline":"main.1","branch":"main","source":1,"outcome":"tier-late","not-running":[{"module":"app","machines":["ace"]}]}`,
|
|
|
|
|
"failed: a tier is late: not running app on ace",
|
|
|
|
|
`{"v":1,"pipeline":"main.1","branch":"main","source":1,"outcome":"running"}`},
|
|
|
|
|
} {
|
|
|
|
|
t.Run(tc.name, func(t *testing.T) {
|
|
|
|
|
_, c, r, ended := pipelineBed(t)
|
|
|
|
|
hear(t, c, tc.key, "", tc.body)
|
|
|
|
|
if tc.then != "" {
|
|
|
|
|
hear(t, c, tc.key, "", tc.then)
|
|
|
|
|
}
|
|
|
|
|
if r.Ended == nil || r.Ended.Why != tc.why || len(*ended) != 1 {
|
|
|
|
|
t.Fatalf("the record ended %+v, said %v; want %q", r.Ended, *ended, tc.why)
|
|
|
|
|
}
|
|
|
|
|