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
+20 -8
View File
@@ -38,7 +38,7 @@ func recording(t *testing.T) (*controlRecorder, controlPlane) {
return c, controlPlane{container: "temp-mesh-controller", run: c.run, timeout: time.Second}
}
func TestTheBuilderOnTheDefaultPackagesPortIsToldNothing(t *testing.T) {
func testTheBuilderOnTheDefaultPackagesPortIsToldNothing(t *testing.T) {
c, control := recording(t)
o := Options{Node: "anchor", Wait: time.Second}
if _, err := installModule(context.Background(), o, control, BuilderModule,
@@ -67,7 +67,7 @@ func aCatalogueWith(t *testing.T, module, manifest string) string {
const theForgesManifest = `{"module": "gitea", "version": "1"}`
func TestThePackagesPortIsTheForgeModulesSettingOnThisNode(t *testing.T) {
func testThePackagesPortIsTheForgeModulesSettingOnThisNode(t *testing.T) {
c, control := recording(t)
o := Options{Node: "anchor", Catalogue: aCatalogueWith(t, ForgeModule, theForgesManifest),
Ports: FoundationPorts{Packages: 3100}, Wait: time.Second}
@@ -104,7 +104,7 @@ func (k *knowingControl) run(ctx context.Context, name string, args ...string) (
return out, err
}
func TestARerunDoesNotReplaceAForgeTheMeshAlreadyHas(t *testing.T) {
func testARerunDoesNotReplaceAForgeTheMeshAlreadyHas(t *testing.T) {
t.Setenv("TMPDIR", t.TempDir())
k := &knowingControl{controlRecorder{settings: map[string]string{}}}
control := controlPlane{container: "mesh-controller", run: k.run, timeout: time.Second}
@@ -125,7 +125,7 @@ func TestARerunDoesNotReplaceAForgeTheMeshAlreadyHas(t *testing.T) {
}
}
func TestAGenesisOnTheCataloguesPackagesPortRegistersNoForge(t *testing.T) {
func testAGenesisOnTheCataloguesPackagesPortRegistersNoForge(t *testing.T) {
c, control := recording(t)
o := Options{Node: "anchor", Catalogue: aCatalogueWith(t, ForgeModule, theForgesManifest),
Wait: time.Second}
@@ -137,7 +137,7 @@ func TestAGenesisOnTheCataloguesPackagesPortRegistersNoForge(t *testing.T) {
}
}
func TestAForgeManifestTheCatalogueDoesNotHaveIsNamed(t *testing.T) {
func testAForgeManifestTheCatalogueDoesNotHaveIsNamed(t *testing.T) {
_, control := recording(t)
o := Options{Node: "anchor", Catalogue: t.TempDir(),
Ports: FoundationPorts{Packages: 3100}, Wait: time.Second}
@@ -182,7 +182,7 @@ func theCataloguesModule(t *testing.T, module string) []byte {
// one-holder `builder` left the catalogue on 2026-10-03, and genesis stopped at step 13 asking for it.
// The catalogue's own manifest is read, and the image the installer carried is put where the manifest
// names the image it builds.
func TestGenesisInstallsTheCataloguesBuildAgent(t *testing.T) {
func testGenesisInstallsTheCataloguesBuildAgent(t *testing.T) {
manifest := theCataloguesModule(t, BuilderModule)
const reference = "127.0.0.1:5000/mesh-builder@sha256:" + "4444444444444444444444444444444444444444444444444444444444444444"
pinned, places, err := pinTheCarriedBuilder(manifest, reference)
@@ -221,7 +221,7 @@ func TestGenesisInstallsTheCataloguesBuildAgent(t *testing.T) {
// A manifest that runs nothing from an image it builds has nowhere to put the carried builder, and is
// refused rather than registered running nothing.
func TestABuildAgentManifestWithNowhereForTheCarriedBuilderIsRefused(t *testing.T) {
func testABuildAgentManifestWithNowhereForTheCarriedBuilderIsRefused(t *testing.T) {
_, _, err := pinTheCarriedBuilder([]byte(`{"module":"build-agent","resources":[{"id":"server","type":"container","name":"x","artifact":"server"}],"build":{"artifacts":[{"name":"server","kind":"bundle"}]}}`),
"127.0.0.1:5000/mesh-builder@sha256:"+strings.Repeat("4", 64))
if err == nil || !strings.Contains(err.Error(), "nowhere to put") {
@@ -232,7 +232,7 @@ func TestABuildAgentManifestWithNowhereForTheCarriedBuilderIsRefused(t *testing.
// 1151: the build agent's manifest lives in the controller's repository now (ADR 0420, issue 1019), and a merge check of
// this repository has the controller cloned beside it, so a tree shaped like that check's, whose catalogue no longer holds
// the build agent, is read from the controller.
func TestTheBuildAgentsManifestIsReadFromTheControllerBesideTheCheck(t *testing.T) {
func testTheBuildAgentsManifestIsReadFromTheControllerBesideTheCheck(t *testing.T) {
beside := t.TempDir()
for path, body := range map[string]string{
"mesh-catalog/modules/nats/module.json": `{"module":"nats"}`,
@@ -254,3 +254,15 @@ func TestTheBuildAgentsManifestIsReadFromTheControllerBesideTheCheck(t *testing.
t.Errorf("a module the catalogue holds was read as %s", got)
}
}
// TestBuilder runs this file's tests, each a subtest named as its function was (design 47 H2 §819, the test budget).
func TestBuilder(t *testing.T) {
t.Run("TheBuilderOnTheDefaultPackagesPortIsToldNothing", testTheBuilderOnTheDefaultPackagesPortIsToldNothing)
t.Run("ThePackagesPortIsTheForgeModulesSettingOnThisNode", testThePackagesPortIsTheForgeModulesSettingOnThisNode)
t.Run("ARerunDoesNotReplaceAForgeTheMeshAlreadyHas", testARerunDoesNotReplaceAForgeTheMeshAlreadyHas)
t.Run("AGenesisOnTheCataloguesPackagesPortRegistersNoForge", testAGenesisOnTheCataloguesPackagesPortRegistersNoForge)
t.Run("AForgeManifestTheCatalogueDoesNotHaveIsNamed", testAForgeManifestTheCatalogueDoesNotHaveIsNamed)
t.Run("GenesisInstallsTheCataloguesBuildAgent", testGenesisInstallsTheCataloguesBuildAgent)
t.Run("ABuildAgentManifestWithNowhereForTheCarriedBuilderIsRefused", testABuildAgentManifestWithNowhereForTheCarriedBuilderIsRefused)
t.Run("TheBuildAgentsManifestIsReadFromTheControllerBesideTheCheck", testTheBuildAgentsManifestIsReadFromTheControllerBesideTheCheck)
}