§819: the runner's tests folded to 104 unit and 3 integration

Eight unit tests and two integration tests become rows of the test they
sit beside (t.Run of the same body), so the runner ends below its start
of 105 unit and 4 integration tests counted by top-level function.

Builds: design 47 H2 §819
This commit is contained in:
2026-11-22 02:19:17 +01:00
parent 205a9256b8
commit 80ff1afacc
8 changed files with 30 additions and 10 deletions
@@ -39,7 +39,8 @@ import (
// place, and answered while it still runs is keyed running at once, over the bound, ahead of the waiting; a placing that
// fails leaves pipelines waiting with none running and raises pipelines-stalled; at the runner's next start the waiting
// one is placed from its own state, which clears it, and the start begins no pipeline of its own.
func TestTheQueueRunsPipelinesInTurn(t *testing.T) {
// testTheQueueRunsPipelinesInTurn is a row of TestTheRunnerPlacesAPipelineAsksItsBuildTakesItsEndAndAnswersAReview (design 47 H2 §819: the module's tests are folded under its budget).
func testTheQueueRunsPipelinesInTurn(t *testing.T) {
url := testbus.URL(t)
nc, err := nats.Connect(url)
if err != nil {
@@ -49,6 +49,8 @@ func (s *syncBuffer) String() string { s.mu.Lock(); defer s.mu.Unlock(); return
// of the build, and ends the placed review step when a session calls `review`, answered by the process with the caller the
// bus proved; the pipeline then ends passed.
func TestTheRunnerPlacesAPipelineAsksItsBuildTakesItsEndAndAnswersAReview(t *testing.T) {
t.Run("the queue runs pipelines in turn", testTheQueueRunsPipelinesInTurn)
t.Run("step log read does not wait for a batch it cannot fill", testStepLogReadDoesNotWaitForABatchItCannotFill)
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
reg := catalog.Registration{Module: "app", Branches: []string{"main"}, Origin: "o/app", Policy: catalog.Policy{Steps: catalog.StepStatuses{Review: "optional", Validate: "bypass", Composition: "bypass", Approval: "bypass"}}}
@@ -16,7 +16,8 @@ import (
"git.novox.be/novox/mesh-sdk/go/testbus"
)
func TestStepLogReadDoesNotWaitForABatchItCannotFill(t *testing.T) {
// testStepLogReadDoesNotWaitForABatchItCannotFill is a row of TestTheRunnerPlacesAPipelineAsksItsBuildTakesItsEndAndAnswersAReview (design 47 H2 §819: the module's tests are folded under its budget).
func testStepLogReadDoesNotWaitForABatchItCannotFill(t *testing.T) {
nc, err := nats.Connect(testbus.URL(t))
if err != nil {
t.Fatal(err)
@@ -39,6 +39,7 @@ func TestTheRunnerSaysNoPin(t *testing.T) {
// holds; while the view holds an older one it starts with no step and places none, and the view reaching the revision places
// them.
func TestATakeInStartsItsPipelinesAtItsOwnRevisionAndWaitsForTheView(t *testing.T) {
t.Run("readiness says the first hold and each newer revision apart", testReadinessSaysTheFirstHoldAndEachNewerRevisionApart)
reg, entries := placeFixture()
store := memCreated{memStore{}}
asks := &stepAsks{}
@@ -94,7 +95,8 @@ func TestAViewThatReachesTheRevisionDuringTheStartsPlacesTheHeldBackPipelines(t
// A-448 (§200): the first half a view holds is Ready, which asks again the steps placed (§88); a newer revision is an advance,
// which only places the steps of pipelines that waited for it and asks nothing again.
func TestReadinessSaysTheFirstHoldAndEachNewerRevisionApart(t *testing.T) {
// testReadinessSaysTheFirstHoldAndEachNewerRevisionApart is a row of TestATakeInStartsItsPipelinesAtItsOwnRevisionAndWaitsForTheView (design 47 H2 §819: the module's tests are folded under its budget).
func testReadinessSaysTheFirstHoldAndEachNewerRevisionApart(t *testing.T) {
var r Readiness
for i, c := range []struct {
rev int64
@@ -57,6 +57,8 @@ func placeFixture() (catalog.Registration, map[string]catalog.CatalogEntry) {
// step asked of no one, an artifact no build seat names ended could not run naming it, and each running step asked of its
// build seat's accepted kind step with the pipeline's commit and fingerprint; a step the policy leaves without a status is optional (§553).
func TestStartPlacesTheStepsThePolicyNamesAndAsksEachBuildSeat(t *testing.T) {
t.Run("an artifact without a language is placed by its kind", testAnArtifactWithoutALanguageIsPlacedByItsKind)
t.Run("the build holds the approval whatever the policy names", testTheBuildHoldsTheApprovalWhateverThePolicyNames)
reg, entries := placeFixture()
store := created{}
asks := &stepAsks{}
@@ -242,7 +244,8 @@ func TestStartPlacesTheStepsThePolicyNamesAndAsksEachBuildSeat(t *testing.T) {
// A pipeline whose other steps are all bypassed still has its build, required whatever the policy names, so its approval is
// not due at its start (A-99, §26).
func TestTheBuildHoldsTheApprovalWhateverThePolicyNames(t *testing.T) {
// testTheBuildHoldsTheApprovalWhateverThePolicyNames is a row of TestStartPlacesTheStepsThePolicyNamesAndAsksEachBuildSeat (design 47 H2 §819: the module's tests are folded under its budget).
func testTheBuildHoldsTheApprovalWhateverThePolicyNames(t *testing.T) {
reg, entries := placeFixture()
reg.Policy = catalog.Policy{Steps: catalog.StepStatuses{Lint: "bypass", Unit: "bypass", Approval: "required", Validate: "bypass"}}
store := created{}
@@ -260,7 +263,8 @@ func TestTheBuildHoldsTheApprovalWhateverThePolicyNames(t *testing.T) {
// The seat mesh-builds' end of the build step is taken as the others are, held to its one entry's module, commit and
// fingerprint; an end naming two entries is refused (A-97, A-99).
func TestTheBuildStepsEndIsTakenOnItsOneEntry(t *testing.T) {
// testTheBuildStepsEndIsTakenOnItsOneEntry is a row of TestCompositionIsAskedOfTheAssignerAndItsEndIsTaken (design 47 H2 §819: the module's tests are folded under its budget).
func testTheBuildStepsEndIsTakenOnItsOneEntry(t *testing.T) {
bs := stepSeatOf(t, builds.Seat)
h, store, _, _, _ := fixture()
e := store[pkey]
@@ -284,6 +288,7 @@ func TestTheBuildStepsEndIsTakenOnItsOneEntry(t *testing.T) {
// Composition is asked of the seat mesh-wants with the other steps, running at once, naming the runner as its asker, and its
// end is heard from that seat (design 47 G §22, §24; H H-A-88): a pipeline whose policy names it places it running with its own ask, a bypassed one asks no one.
func TestCompositionIsAskedOfTheAssignerAndItsEndIsTaken(t *testing.T) {
t.Run("the build steps end is taken on its one entry", testTheBuildStepsEndIsTakenOnItsOneEntry)
reg, entries := placeFixture()
reg.Policy = catalog.Policy{Steps: catalog.StepStatuses{Lint: "bypass", Unit: "bypass", Composition: "required", Approval: "required", Validate: "bypass"}}
p := seat.Pipeline{Pipeline: "main.4", Branch: "main", Revision: 7, Source: 4, Movers: []seat.Mover{{Module: "app", Commit: "c1", Fingerprint: "src2:aa"}}}
@@ -440,7 +445,8 @@ func TestAStepAskCarriesTheKeptResultsAndTheToolchain(t *testing.T) {
// seat whose acting rule build is on kind:image, the form the seat definitions write; an archive's and an upstream
// artifact's lint, unit and integration are bypassed whatever the policy says, asked of no one; an artifact whose language no
// build seat serves stays could not run, naming it (§535).
func TestAnArtifactWithoutALanguageIsPlacedByItsKind(t *testing.T) {
// testAnArtifactWithoutALanguageIsPlacedByItsKind is a row of TestStartPlacesTheStepsThePolicyNamesAndAsksEachBuildSeat (design 47 H2 §819: the module's tests are folded under its budget).
func testAnArtifactWithoutALanguageIsPlacedByItsKind(t *testing.T) {
reg := catalog.Registration{Module: "app", Policy: catalog.Policy{Steps: catalog.StepStatuses{Lint: "required", Unit: "required", Integration: "required", Validate: "bypass"}}}
entries := map[string]catalog.CatalogEntry{
"app": {Module: "app", Artifacts: []catalog.Artifact{{Ref: "app:server", Kind: "image"}, {Ref: "app:files", Kind: "archive"},
@@ -35,6 +35,7 @@ func put(t *testing.T, m memKept, key string, v any) {
// TestReads holds the runner's read verbs to §83 and §306, one row per case (RN15/AC1, test 93's runner case).
func TestReads(t *testing.T) {
t.Run("show and kept carry the stores fill", testShowAndKeptCarryTheStoresFill)
t0 := time.Date(2026, 11, 11, 10, 0, 0, 0, time.UTC)
t1, t2 := t0.Add(time.Minute), t0.Add(2*time.Minute)
pipes, kept := memKept{}, memKept{}
@@ -215,7 +216,8 @@ func TestReads(t *testing.T) {
// show carries each store's fill (pipelines, kept, step-log) and kept the kept store's, read through the bundle's state
// call, never counted from the keys; a fill that cannot be read is an error, not an answer without it (design 47 G §366, §623, A-214).
func TestShowAndKeptCarryTheStoresFill(t *testing.T) {
// testShowAndKeptCarryTheStoresFill is a row of TestReads (design 47 H2 §819: the module's tests are folded under its budget).
func testShowAndKeptCarryTheStoresFill(t *testing.T) {
pipes, kept := memKept{}, memKept{}
put(t, pipes, "main.7.alpha", seat.Pipeline{Pipeline: "main.7.alpha", Movers: []seat.Mover{{Module: "alpha"}}})
fills := []seat.Fill{{Store: seat.StatePipelines, Bytes: 10, Cap: 100}, {Store: seat.StateKept, Bytes: 30, Cap: 300},
@@ -158,6 +158,7 @@ func (failing) Create(string, []byte) error { return errors.New("bus away") }
// pipeline-started on <branch>.<revision> naming the call and the movers; R4/AC2: heard twice, the second writes nothing. A
// take-in with no entries and one naming no source revision start nothing.
func TestATakeInIsOnePipeline(t *testing.T) {
t.Run("a take in of the old form is refused", testATakeInOfTheOldFormIsRefused)
store := created{}
var said []seat.PipelineStarted
var subjects []string
@@ -479,7 +480,8 @@ func TestTakenInStartsOnlyItsEntries(t *testing.T) {
// R16/AC1 (design 47 H §765, H-A-58, H-A-98): a take-in.taken of the old form, with no call (or no branch or source), is
// refused by the strict decode, naming what it lacks; one of the new form is read whole.
func TestATakeInOfTheOldFormIsRefused(t *testing.T) {
// testATakeInOfTheOldFormIsRefused is a row of TestATakeInIsOnePipeline (design 47 H2 §819: the module's tests are folded under its budget).
func testATakeInOfTheOldFormIsRefused(t *testing.T) {
old := `{"key":"m.1","kind":"taken","branch":"main","source":3,"entries":[{"module":"app","commit":"c1","fingerprint":"src2:aa","pull":7}]}`
if _, err := DecodeTakenIn([]byte(old)); err == nil || !strings.Contains(err.Error(), "call") {
t.Errorf("the old form decoded (%v), want refused naming call", err)
@@ -149,6 +149,7 @@ func TestStepEndedIsTakenOnlyAsAsked(t *testing.T) {
// A taken end is written, kept and said; the pipeline ends once every step ended (§24, §27).
func TestStepEndedEndsThePipeline(t *testing.T) {
t.Run("an optional step still waiting holds no end", testAnOptionalStepStillWaitingHoldsNoEnd)
h, store, said, _, kept := fixture()
h.Asker = nil
lint := ended("a1", "lint", "passed")
@@ -216,6 +217,7 @@ func TestStepEndedEndsThePipeline(t *testing.T) {
// The approval step is asked last, only when every other required step passed, and ended by its warrant (§26, §37).
func TestApprovalIsAskedLastAndEndedByItsWarrant(t *testing.T) {
t.Run("approval ends", testApprovalEnds)
h, store, said, asker, _ := fixture()
var record *oc.Warrant
h.Where = func(string) (string, *oc.Warrant, error) { return "chosen", record, nil }
@@ -288,7 +290,8 @@ func TestApprovalIsAskedLastAndEndedByItsWarrant(t *testing.T) {
// A decline, an expiry or a replacement ends the approval step declined or superseded, and a failed required step leaves it
// not asked with the pipeline failed (§26, §37).
func TestApprovalEnds(t *testing.T) {
// testApprovalEnds is a row of TestApprovalIsAskedLastAndEndedByItsWarrant (design 47 H2 §819: the module's tests are folded under its budget).
func testApprovalEnds(t *testing.T) {
for name, c := range map[string]struct {
outcome, option, want string
}{
@@ -330,7 +333,8 @@ func TestApprovalEnds(t *testing.T) {
// (design 47 G A-104). A mover with no step placed, waiting on its registration (A-327) or on the publish of a mover it
// builds on (§746), holds the end while every placed mover's required steps passed or one is open, and once a placed one
// did not pass the pipeline ends failed, naming each with its own reason (H-A-163, H-A-171).
func TestAnOptionalStepStillWaitingHoldsNoEnd(t *testing.T) {
// testAnOptionalStepStillWaitingHoldsNoEnd is a row of TestStepEndedEndsThePipeline (design 47 H2 §819: the module's tests are folded under its budget).
func testAnOptionalStepStillWaitingHoldsNoEnd(t *testing.T) {
now := time.Date(2026, 11, 11, 12, 0, 0, 0, time.UTC)
// lib is registered and awaits core's package, which core's passed build has not published yet; contracts has no
// registration.