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
@@ -38,7 +38,7 @@ func theExample(t *testing.T) Rewritten {
// file genesis made, and the controller's account on the bus is the made one in both places the
// bundle names it — the address the control plane dials and the user list the bus is raised with
// (novox/hq issue 071, ADR 0331 §3).
func TestTheProducedBundleCarriesNoWellKnownCredential(t *testing.T) {
func testTheProducedBundleCarriesNoWellKnownCredential(t *testing.T) {
r := theExample(t)
creds := testCredentials(t, "STORE-PW-40-characters-of-random-base64u", "BUS-PW-40-characters-of-random-base64uuu")
got, err := RewriteRoot(&r, creds)
@@ -109,7 +109,7 @@ func hashOf(t *testing.T, list, user string) string {
// The bus's placeholders are what the installer looks for, and a template naming no bus connection
// it knows is refused at preflight, naming the placeholder (novox/hq ADR 0331 §3, §4).
func TestABundleNamingNoBusConnectionItKnowsIsRefusedByItsPlaceholder(t *testing.T) {
func testABundleNamingNoBusConnectionItKnowsIsRefusedByItsPlaceholder(t *testing.T) {
template, err := os.ReadFile("../../examples/foundation-first-node.lock")
if err != nil {
t.Skip("no example bundle beside this checkout")
@@ -151,7 +151,7 @@ func TestABundleNamingNoBusConnectionItKnowsIsRefusedByItsPlaceholder(t *testing
// The account is made once, with its hash, and a second run puts the same bytes in the bundle — a
// hash salted afresh every run would rewrite the bus's user list every run.
func TestTheBusAccountIsKeptWithItsHash(t *testing.T) {
func testTheBusAccountIsKeptWithItsHash(t *testing.T) {
dir := t.TempDir()
first, err := rootSecretsAt(dir+"/store", dir+"/bus", dir+"/bus.bcrypt", false)
if err != nil {
@@ -171,7 +171,7 @@ func TestTheBusAccountIsKeptWithItsHash(t *testing.T) {
}
// Made once and kept: a second run reads the same value; a dry run writes nothing.
func TestRootSecretsAreKeptAcrossRuns(t *testing.T) {
func testRootSecretsAreKeptAcrossRuns(t *testing.T) {
dir := t.TempDir()
path := dir + "/superuser.secret"
first, made, err := keptOrMade(path, false)
@@ -195,7 +195,7 @@ func TestRootSecretsAreKeptAcrossRuns(t *testing.T) {
}
// Nothing the installer says after making the credentials contains them.
func TestTheTranscriptNeverSaysTheCredentials(t *testing.T) {
func testTheTranscriptNeverSaysTheCredentials(t *testing.T) {
var said []string
say := Masking(func(l string) { said = append(said, l) }, RootCredentials{Store: "STORE-PW", Bus: "BUS-PW"})
say("created context-schemas (docker run -e MESH_STORE_INVENTORY=postgres://postgres:STORE-PW@127.0.0.1:5432/inventory)")
@@ -213,7 +213,7 @@ func TestTheTranscriptNeverSaysTheCredentials(t *testing.T) {
// The foundation filters before anything listens: nftables is in place before the store, and its
// rules refuse the store's and broker's client ports from outside while keeping ssh, the bus a node
// enrols over and the registry a node pulls from (novox/hq issue 054).
func TestTheFoundationFiltersBeforeAnythingListens(t *testing.T) {
func testTheFoundationFiltersBeforeAnythingListens(t *testing.T) {
r := theExample(t)
if _, err := RewriteRoot(&r, testCredentials(t, "s", "b")); err != nil {
t.Fatal(err)
@@ -254,7 +254,7 @@ func TestTheFoundationFiltersBeforeAnythingListens(t *testing.T) {
// <data root>/mesh (/var/lib/mesh/postgres), no longer in /var/lib/postgres, the postgresql package's own. A
// directory genesis makes on the way keeps the mode the mesh's directories have (0755, so every module's account
// reaches its own below it); only the credential's own directory is closed, 0700.
func TestTheStoreSuperuserFileLiesInTheModulesOwnDirectory(t *testing.T) {
func testTheStoreSuperuserFileLiesInTheModulesOwnDirectory(t *testing.T) {
if StoreSuperuserFile != "/var/lib/mesh/postgres/superuser.secret" {
t.Errorf("the store's superuser file is %s, not the postgres module's /var/lib/mesh/postgres/superuser.secret", StoreSuperuserFile)
}
@@ -273,3 +273,14 @@ func TestTheStoreSuperuserFileLiesInTheModulesOwnDirectory(t *testing.T) {
}
}
}
// TestRootsecrets runs this file's tests, each a subtest named as its function was (design 47 H2 §819, the test budget).
func TestRootsecrets(t *testing.T) {
t.Run("TheProducedBundleCarriesNoWellKnownCredential", testTheProducedBundleCarriesNoWellKnownCredential)
t.Run("ABundleNamingNoBusConnectionItKnowsIsRefusedByItsPlaceholder", testABundleNamingNoBusConnectionItKnowsIsRefusedByItsPlaceholder)
t.Run("TheBusAccountIsKeptWithItsHash", testTheBusAccountIsKeptWithItsHash)
t.Run("RootSecretsAreKeptAcrossRuns", testRootSecretsAreKeptAcrossRuns)
t.Run("TheTranscriptNeverSaysTheCredentials", testTheTranscriptNeverSaysTheCredentials)
t.Run("TheFoundationFiltersBeforeAnythingListens", testTheFoundationFiltersBeforeAnythingListens)
t.Run("TheStoreSuperuserFileLiesInTheModulesOwnDirectory", testTheStoreSuperuserFileLiesInTheModulesOwnDirectory)
}