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
+12 -4
View File
@@ -33,7 +33,7 @@ func bundle(t *testing.T) *declaration.Declaration {
// The object store was foundation for months on the strength of "it cannot grant itself a bucket",
// which answers half the test. The control plane never needed one, and nothing noticed because
// nothing counted what the bundle holds.
func TestTheBundleCarriesTheFoundationAndTheControlPlaneAndNothingElse(t *testing.T) {
func testTheBundleCarriesTheFoundationAndTheControlPlaneAndNothingElse(t *testing.T) {
var images []string
for _, r := range bundle(t).Resources {
c, ok := r.(*declaration.Container)
@@ -59,7 +59,7 @@ func TestTheBundleCarriesTheFoundationAndTheControlPlaneAndNothingElse(t *testin
// The control plane is in the bundle, and the design overlooked it once by reasoning about
// foundation services rather than counting containers (novox/hq 03-DESIGN/01-to-be/07).
func TestTheControlPlaneIsCarriedToo(t *testing.T) {
func testTheControlPlaneIsCarriedToo(t *testing.T) {
for _, r := range bundle(t).Resources {
if c, ok := r.(*declaration.Container); ok && strings.Contains(c.Image, "mesh-controller") {
return
@@ -71,7 +71,7 @@ func TestTheControlPlaneIsCarriedToo(t *testing.T) {
// One genesis bundle, on the bus the mesh runs on (novox/hq ADR 0331 §2). Two bundles let every bed
// and README name the one that could not raise a mesh, for weeks (issue 146).
func TestThereIsOneGenesisBundle(t *testing.T) {
func testThereIsOneGenesisBundle(t *testing.T) {
bundles, err := filepath.Glob("*.lock")
if err != nil {
t.Fatal(err)
@@ -83,7 +83,7 @@ func TestThereIsOneGenesisBundle(t *testing.T) {
// The control plane the bundle raises is given the bus, with the account the installer fills and
// the certificate it pins (ADR 0331 §4); without it, it crash-loops for ever (issue 146).
func TestTheControlPlaneIsGivenTheBus(t *testing.T) {
func testTheControlPlaneIsGivenTheBus(t *testing.T) {
for _, r := range bundle(t).Resources {
c, ok := r.(*declaration.Container)
if !ok || !strings.Contains(c.Image, "mesh-controller") {
@@ -97,3 +97,11 @@ func TestTheControlPlaneIsGivenTheBus(t *testing.T) {
}
t.Fatal("nothing in the bundle starts the control plane")
}
// TestBundle runs this file's tests, each a subtest named as its function was (design 47 H2 §819, the test budget).
func TestBundle(t *testing.T) {
t.Run("TheBundleCarriesTheFoundationAndTheControlPlaneAndNothingElse", testTheBundleCarriesTheFoundationAndTheControlPlaneAndNothingElse)
t.Run("TheControlPlaneIsCarriedToo", testTheControlPlaneIsCarriedToo)
t.Run("ThereIsOneGenesisBundle", testThereIsOneGenesisBundle)
t.Run("TheControlPlaneIsGivenTheBus", testTheControlPlaneIsGivenTheBus)
}