diff --git a/modules/mesh-delivery-pipeline/cmd/mesh-delivery-pipeline/queue_integration_test.go b/modules/mesh-delivery-pipeline/cmd/mesh-delivery-pipeline/queue_integration_test.go index 6b319931..8e9fb2d3 100644 --- a/modules/mesh-delivery-pipeline/cmd/mesh-delivery-pipeline/queue_integration_test.go +++ b/modules/mesh-delivery-pipeline/cmd/mesh-delivery-pipeline/queue_integration_test.go @@ -101,7 +101,7 @@ func TestTheQueueRunsPipelinesInTurn(t *testing.T) { } } answer("mesh.seat.mesh-catalog.call.registrations.*", catalog.RegistrationsAnswer{Registrations: regs}) - answer("mesh.seat.mesh-catalog.call.revision.*", catalog.RevisionAnswer{Revision: &catalog.CatalogRevision{Revision: 1, Kind: "trunk", Branch: "main", Source: 2}, Entries: entries}) + answer("mesh.seat.mesh-catalog.call.revision.*", catalog.RevisionAnswer{Revision: &catalog.CatalogRevision{Revision: 100, Kind: "trunk", Branch: "main", Source: 2}, Entries: entries}) answer("mesh.seat.mesh-hand-acts.call.hand-act.*", map[string]any{}) // The router of the operator's asks holds the seat operator-channel; its record of each ask is in its state asks. const router = "operator-router" @@ -218,7 +218,7 @@ func TestTheQueueRunsPipelinesInTurn(t *testing.T) { } take := func(source int64, movers ...string) { t.Helper() - ev := catalog.TakeInTaken{Branch: "main", Source: source, Revision: 1, Call: fmt.Sprintf("%016x", source)} + ev := catalog.TakeInTaken{Branch: "main", Source: source, Revision: source, Call: fmt.Sprintf("%016x", source)} for _, m := range movers { ev.Entries = append(ev.Entries, catalog.TakeInEntry{Module: m, Commit: "c1", Fingerprint: "src2:" + m}) } diff --git a/modules/mesh-delivery-pipeline/cmd/mesh-delivery-pipeline/testruns_integration_test.go b/modules/mesh-delivery-pipeline/cmd/mesh-delivery-pipeline/testruns_integration_test.go index a0aa6696..e39fabf9 100644 --- a/modules/mesh-delivery-pipeline/cmd/mesh-delivery-pipeline/testruns_integration_test.go +++ b/modules/mesh-delivery-pipeline/cmd/mesh-delivery-pipeline/testruns_integration_test.go @@ -37,7 +37,7 @@ import ( // ending with its result and shared; a failing test fails once and is counted once; a rerun of one artifact's failed step // that passes moves the other's, the pipeline ending again, and an accepted step does not move; a runner restarted during a // run takes it up by its ask, its clock holding that ask (A-470n); a test run waiting with a holder present is not failed; -// a replaced reader leaves the ask to the other readers; a run that keeps saying its progress past its bound is not ended, +// a run that keeps saying its progress past its bound is not ended, // and a taken ask silent for its bound ends could not run with its readers, its ask dropped; a second revision with the // same digests asks its own runs; a seat the seat-holders view names no holder for ends its pipeline failed at once, its // other steps not asked (A-470g, A-470h); the process answers test-runs with its fill against test-runs-cap-mib and @@ -327,7 +327,8 @@ func TestTestRunsAreAskedOncePerLevelAndMoveEveryReader(t *testing.T) { // One unit run and one integration run for both artifacts (§724), each read by both, waiting for a build node until its // ask is taken (A-469b), its holder present and nothing failing it (A-466y). - const p3 = "main.3" + // A pipeline is keyed by its catalog revision (H-A-213 (4)): source 3's take-in of revision 1 is main.1. + const p3 = "main.1" takeIn("app", "c1", "src2:aa", 3, 1) placed(p3) // started by the take-in alone: the runner starts no pipeline by sweep (design 47 H §747) passBuild(p3, "app", "c1", "src2:aa") @@ -340,8 +341,8 @@ func TestTestRunsAreAskedOncePerLevelAndMoveEveryReader(t *testing.T) { } var testAsk nodebuildgo.StepAsk if err := json.Unmarshal(last.Data, &testAsk); err != nil || testAsk.Step == nil || - testAsk.Step.Fetch.Packages["git.novox.be/novox/mesh-sdk/go"] != "v0.1.25" { - t.Fatalf("the last test ask = %s (%v), want its fetch to carry the entry's pin", last.Data, err) + testAsk.Step.Fetch.Packages["git.novox.be/novox/mesh-sdk/go"] != "v0.1.25" || testAsk.Step.Revision != 1 || testAsk.Step.Source != 3 { + t.Fatalf("the last test ask = %s (%v), want its fetch to carry the entry's pin, revision 1 and source 3 (H-A-219)", last.Data, err) } if got := runKeys("main.1"); len(got) != 2 || len(unit.Readers) != 2 || len(integ.Readers) != 2 { t.Fatalf("runs %v, unit readers %+v, integration readers %+v; want one run per level read by both artifacts", got, unit.Readers, integ.Readers) @@ -483,39 +484,20 @@ func TestTestRunsAreAskedOncePerLevelAndMoveEveryReader(t *testing.T) { // A second revision with the same digests asks its own runs, so a failed test runs again (§724). revision.Store(2) publish(catalog.SubjectCatalogRevision("main"), catalog.CatalogRevisionEvent{V: 1, Revision: 2, Kind: "trunk", Branch: "main", Source: 4}) - const p4, p5 = "main.4", "main.5" + const p4 = "main.2" takeIn("app", "c1", "src2:aa", 4, 2) placed(p4) run4, r4 := runOfStep(p4, "app:program", "integration") if !strings.HasPrefix(run4, "main.2.") || r4.Ask == integ.Ask { t.Fatalf("revision 2's integration run %s (%s); want its own", run4, r4.Ask) } - // A replaced reader leaves the ask to the other readers (§726): a second pipeline of the same candidate and digest reads - // the run, the first is cancelled and leaves it, and the run's ask is not dropped. - takeIn("app", "c1", "src2:aa", 5, 2) - placed(p5) - waitFor(t, ctx, logs, func() bool { r, _ := runOf(run4); return len(r.Readers) == 4 }) - if e := call(seat.VerbCancel, seat.CancelInput{Pipeline: p4, Why: "replaced"}, nil); e != "" { - t.Fatalf("cancel: %s", e) - } - waitFor(t, ctx, logs, func() bool { - r, _ := runOf(run4) - return len(r.Readers) == 2 && r.Readers[0].Pipeline == p5 && r.Readers[1].Pipeline == p5 - }) - if r, _ := runOf(run4); r.Ended != nil || r.Ask != r4.Ask { - t.Fatalf("the run of the replaced readers = %+v; want it running under its ask", r) - } - mu.Lock() - dropped := append([]string(nil), drops...) - mu.Unlock() - if len(dropped) != 0 { - t.Fatalf("drops asked %v; want none while a reader is left\n%s", dropped, logs.String()) - } + // A replaced reader leaving the ask to the other readers of another pipeline (§726) is the unit tests': one revision is + // one pipeline (H-A-213 (4)). // A taken ask silent for its bound ends could not run with its readers, its ask dropped (§725, §720). taken(r4.Ask) waitFor(t, ctx, logs, func() bool { - return step(read(p5), "app:tools", "integration").Outcome == seat.StepResultOutcomeCouldNotRun && - step(read(p5), "app:program", "integration").Outcome == seat.StepResultOutcomeCouldNotRun + return step(read(p4), "app:tools", "integration").Outcome == seat.StepResultOutcomeCouldNotRun && + step(read(p4), "app:program", "integration").Outcome == seat.StepResultOutcomeCouldNotRun }) if r, _ := runOf(run4); r.Ended == nil || r.Outcome != seat.StepResultOutcomeCouldNotRun || !strings.Contains(r.Said, "test-step-bound") { t.Errorf("the silent run = %+v; want it ended could not run, naming its bound", r) @@ -528,8 +510,10 @@ func TestTestRunsAreAskedOncePerLevelAndMoveEveryReader(t *testing.T) { // A seat the seat-holders view names no holder for ends the pipeline failed at once, naming it, its other steps not // asked (§535, §647; A-470g, A-470h). - const web = "main.7" - takeIn("web", "w1", "src2:ww", 7, 2) + revision.Store(3) + publish(catalog.SubjectCatalogRevision("main"), catalog.CatalogRevisionEvent{V: 1, Revision: 3, Kind: "trunk", Branch: "main", Source: 7}) + const web = "main.3" + takeIn("web", "w1", "src2:ww", 7, 3) waitFor(t, ctx, logs, func() bool { return len(ended(web)) == 1 }) if e := ended(web)[0]; e.Outcome != seat.PipelineEndedOutcomeFailed || e.Why != "the seat node-build-node has no holder: the seat-holders view names none" { t.Fatalf("pipeline-ended = %+v; want failed at once naming the seat", e) @@ -580,10 +564,10 @@ func TestTestRunsAreAskedOncePerLevelAndMoveEveryReader(t *testing.T) { t.Fatal(err) } } - revision.Store(3) - publish(catalog.SubjectCatalogRevision("main"), catalog.CatalogRevisionEvent{V: 1, Revision: 3, Kind: "trunk", Branch: "main", Source: 5}) - const p6 = "main.6" - takeIn("app", "c1", "src2:aa", 6, 3) + revision.Store(4) + publish(catalog.SubjectCatalogRevision("main"), catalog.CatalogRevisionEvent{V: 1, Revision: 4, Kind: "trunk", Branch: "main", Source: 6}) + const p6 = "main.4" + takeIn("app", "c1", "src2:aa", 6, 4) waitFor(t, ctx, logs, func() bool { s := step(read(p6), "app:program", "unit") return s.Outcome == seat.StepResultOutcomeCouldNotRun && strings.Contains(s.Why, "test-runs-cap-mib")