E8: run each file's unit tests as subtests of one test

The node-engine held 1,707 top-level unit tests against the budget of 500
a module. Each unit test file with two or more tests now runs them as
subtests of one test named for the file, each named as its function was,
in the same order: every check is kept, and the check counts 383. Files
with a TestMain, a re-run of a test by its name, or the integration tag
are left. Four files of this branch's earlier commits are formatted.

Builds: design 47 H2 §819; H-A-349 DQ-14
This commit is contained in:
2026-11-22 00:30:05 +01:00
parent a882051de6
commit 0c01c81c3f
257 changed files with 4189 additions and 1589 deletions
+18 -7
View File
@@ -209,7 +209,7 @@ func quiet(t *testing.T, out <-chan agent.Update) {
// Issue 1126 (ADR 0547 §2): the node composes its wanted modules and its own composition from its inputs on the bus once
// every input was read, hands each, then Caught; an input that changes nothing composed hands nothing; a module no want
// names any more is taken back; a node that cannot compose says so once and hands nothing.
func TestTheNodeComposesItsWantsFromTheBus(t *testing.T) {
func testTheNodeComposesItsWantsFromTheBus(t *testing.T) {
t.Run("it reads the catalog half by the fingerprints its wants name", composeFromEntries)
t.Run("a running module without an entry stands as the newest build", runningModuleWithoutEntryStandsAsTheNewestBuild)
t.Run("a want naming its version is resolved through the registry seats", aWantNamingItsVersionIsResolvedThroughTheRegistrySeats)
@@ -1836,7 +1836,7 @@ func (r fixedReader) Served(context.Context, string, string, []string) (map[stri
// counts the module as run inside its own composition (issue 1126, review round 2): a failed have that names nothing
// it runs (NotComposed before the module ever ran) is not, so the next composition does not take the module from its
// manifest past its build.
func TestAHaveSaysWhetherItsModuleRunsInsideTheNodesOwn(t *testing.T) {
func testAHaveSaysWhetherItsModuleRunsInsideTheNodesOwn(t *testing.T) {
for _, row := range []struct {
name string
have nodeengine.HaveByNodeModuleValue
@@ -1918,7 +1918,7 @@ func (g *namedGate) Status() seatlist.Status {
// ADR 0636 §1: a node that has not read the seat list composes nothing new of a module whose seats are not bootstrapped,
// says it holds the module (so its have says why) and hands it at the read, which the reader says as an event; what
// already runs with the same composition is not held.
func TestAnUnreadSeatListHoldsWhatIsNewAndHandsItAtTheRead(t *testing.T) {
func testAnUnreadSeatListHoldsWhatIsNewAndHandsItAtTheRead(t *testing.T) {
b := newFakeBus()
fp := meshcatalogclient.SourcePrefix2 + strings.Repeat("a", 64)
digest := meshcatalogclient.ManifestDigest([]byte(lemurs))
@@ -2062,7 +2062,7 @@ func TestAnUnreadSeatListHoldsWhatIsNewAndHandsItAtTheRead(t *testing.T) {
}
}
func TestAHeldOwnCompositionThatWasHandedIsNotDropped(t *testing.T) {
func testAHeldOwnCompositionThatWasHandedIsNotDropped(t *testing.T) {
b := newFakeBus()
fp := meshcatalogclient.SourcePrefix2 + strings.Repeat("a", 64)
digest := meshcatalogclient.ManifestDigest([]byte(lemurs))
@@ -2129,7 +2129,7 @@ func TestAHeldOwnCompositionThatWasHandedIsNotDropped(t *testing.T) {
// a node whose new own composition must start the holder of the seat mesh-catalog composes of it, whatever the list says,
// the holder's resources and its account and nothing else, over what the node's own composition ran before; and the rest
// of the new one is handed once the list was read.
func TestAnUnreadSeatListLetsThroughOfTheOwnCompositionOnlyWhatTheHolderOfTheCatalogNeeds(t *testing.T) {
func testAnUnreadSeatListLetsThroughOfTheOwnCompositionOnlyWhatTheHolderOfTheCatalogNeeds(t *testing.T) {
catalog := `{"module":"catalog","version":"1","claims":[{"name":"` + meshcatalog.Seat + `"}]}`
other := `{"module":"other","version":"1","claims":[{"name":"node-files"}]}`
c := New(newFakeBus().env())
@@ -2177,7 +2177,7 @@ func TestAnUnreadSeatListLetsThroughOfTheOwnCompositionOnlyWhatTheHolderOfTheCat
// ADR 0636 §1, the whole case: a node that runs two modules inside its own composition (a build of the old form each),
// one of them the holder of the seat mesh-catalog, and reads no seat list. Its own composition, handed before the read,
// carries the holder; the read, said as an event, hands the rest, the other module's resources, with no timer.
func TestTheHolderOfTheCatalogIsStartedFromTheOwnCompositionBeforeTheListIsReadAndTheRestAfter(t *testing.T) {
func testTheHolderOfTheCatalogIsStartedFromTheOwnCompositionBeforeTheListIsReadAndTheRestAfter(t *testing.T) {
catalog := `{"module":"catalog","version":"1","claims":[{"name":"` + meshcatalog.Seat + `"}],"capabilities":["systemd"],` +
`"resources":[{"id":"service","type":"service","unit":"catalog.service","state":"running","boot":"enabled"}]}`
other := `{"module":"other","version":"1","capabilities":["systemd"],` +
@@ -2260,7 +2260,7 @@ func TestTheHolderOfTheCatalogIsStartedFromTheOwnCompositionBeforeTheListIsReadA
}
// ADR 0636 §1: a reader the node could not start is no reader that gates nothing: the node holds like one that waits.
func TestACompositionHoldsWhenTheSeatListReaderCouldNotStart(t *testing.T) {
func testACompositionHoldsWhenTheSeatListReaderCouldNotStart(t *testing.T) {
gate := Unread{}
c := New(newFakeBus().env())
comps := map[string]compositions.Composed{"n1.node": {Node: "n1"}}
@@ -2295,3 +2295,14 @@ func (b *patternBus) putAssigned(vals map[string][]byte, rev uint64) {
b.put(buckets.Assignments, k, vals[k], rev)
}
}
// TestSelfcompose runs this file's tests, each a subtest named as its function was (design 47 H2 §819, the test budget).
func TestSelfcompose(t *testing.T) {
t.Run("TheNodeComposesItsWantsFromTheBus", testTheNodeComposesItsWantsFromTheBus)
t.Run("AHaveSaysWhetherItsModuleRunsInsideTheNodesOwn", testAHaveSaysWhetherItsModuleRunsInsideTheNodesOwn)
t.Run("AnUnreadSeatListHoldsWhatIsNewAndHandsItAtTheRead", testAnUnreadSeatListHoldsWhatIsNewAndHandsItAtTheRead)
t.Run("AHeldOwnCompositionThatWasHandedIsNotDropped", testAHeldOwnCompositionThatWasHandedIsNotDropped)
t.Run("AnUnreadSeatListLetsThroughOfTheOwnCompositionOnlyWhatTheHolderOfTheCatalogNeeds", testAnUnreadSeatListLetsThroughOfTheOwnCompositionOnlyWhatTheHolderOfTheCatalogNeeds)
t.Run("TheHolderOfTheCatalogIsStartedFromTheOwnCompositionBeforeTheListIsReadAndTheRestAfter", testTheHolderOfTheCatalogIsStartedFromTheOwnCompositionBeforeTheListIsReadAndTheRestAfter)
t.Run("ACompositionHoldsWhenTheSeatListReaderCouldNotStart", testACompositionHoldsWhenTheSeatListReaderCouldNotStart)
}