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:
@@ -41,7 +41,7 @@ func placed(t *testing.T, in Input, node string) Placed {
|
||||
|
||||
// 1363/AC1 and AC2: a port the Input holds as allocated on the node is the one composed; with none, no number is invented: the
|
||||
// manifest's own is composed and the port is named foreseen, as the Foreseeing mode does.
|
||||
func TestAnAllocatedPortIsComposedAndAnUnallocatedOneIsNamedForeseenNotInvented(t *testing.T) {
|
||||
func testAnAllocatedPortIsComposedAndAnUnallocatedOneIsNamedForeseenNotInvented(t *testing.T) {
|
||||
mk := func() Input {
|
||||
in := aMesh(t)
|
||||
in.Catalogue["web"] = aWebModule()
|
||||
@@ -81,7 +81,7 @@ func TestAnAllocatedPortIsComposedAndAnUnallocatedOneIsNamedForeseenNotInvented(
|
||||
|
||||
// 1363/AC3: a port the operator gave is used, over the allocated one, and a consumer elsewhere is told it
|
||||
// (mesh-controller sendable_integration_test.go TestConsumersAreToldTheGivenPort).
|
||||
func TestAPortTheOperatorGaveIsUsedAndNotReallocated(t *testing.T) {
|
||||
func testAPortTheOperatorGaveIsUsedAndNotReallocated(t *testing.T) {
|
||||
in := aMesh(t)
|
||||
in.Catalogue["store"] = aStoreModule()
|
||||
in.Catalogue["app"] = catalogue.Manifest{Module: "app", Version: "1", Requires: []string{"database"}}
|
||||
@@ -131,7 +131,7 @@ func TestAPortTheOperatorGaveIsUsedAndNotReallocated(t *testing.T) {
|
||||
// 1363/AC4: the seats held and taken reach the Rendering: where each mesh-scoped seat's holder put its ports, from the node's
|
||||
// given and assigned ports, never the manifest's own; and on an adopted node a holder assigned but not taken counts only by its
|
||||
// given ports (novox/hq ADR 0100).
|
||||
func TestSeatsHeldAndTakenReachTheRendering(t *testing.T) {
|
||||
func testSeatsHeldAndTakenReachTheRendering(t *testing.T) {
|
||||
in := aMesh(t)
|
||||
holder := aStoreModule()
|
||||
holder.Claims = []catalogue.Claim{{Name: "mesh-store", Scope: catalogue.ScopeMesh}}
|
||||
@@ -163,7 +163,7 @@ func TestSeatsHeldAndTakenReachTheRendering(t *testing.T) {
|
||||
// 1363/AC4: local networks and outward links (mesh-controller local_network_test.go TestNodeShowsWhichAttachedNetworksCountAndWhy,
|
||||
// the values): a private network on a link facing outside counts, a public subnet and the private network's own link never do; a
|
||||
// machine that said none judges to nothing.
|
||||
func TestLocalNetworksAndOutwardLinksReachTheRendering(t *testing.T) {
|
||||
func testLocalNetworksAndOutwardLinksReachTheRendering(t *testing.T) {
|
||||
in := aMesh(t)
|
||||
laptop := nodeOf(t, &in, "laptop")
|
||||
laptop.OutwardLinks = []string{"eth0", "eth1"}
|
||||
@@ -184,7 +184,7 @@ func TestLocalNetworksAndOutwardLinksReachTheRendering(t *testing.T) {
|
||||
}
|
||||
|
||||
// 1363/AC4: accounts, the names of the mesh, the mesh range and the operator's export reach the Rendering.
|
||||
func TestAccountsNamesAndTheOperatorsExportReachTheRendering(t *testing.T) {
|
||||
func testAccountsNamesAndTheOperatorsExportReachTheRendering(t *testing.T) {
|
||||
in := aMesh(t)
|
||||
nodeOf(t, &in, "anchor").Account = "jochens"
|
||||
in.OperatorExport = &catalogue.KeptExport{}
|
||||
@@ -223,7 +223,7 @@ func TestAccountsNamesAndTheOperatorsExportReachTheRendering(t *testing.T) {
|
||||
|
||||
// The names the operator gave to peers of an adopted tunnel answer until they enrol (novox/hq issue 112); a node of the mesh owns
|
||||
// its name.
|
||||
func TestACarriedPeerIsNamedUntilItEnrols(t *testing.T) {
|
||||
func testACarriedPeerIsNamedUntilItEnrols(t *testing.T) {
|
||||
in := aMesh(t)
|
||||
in.CarriedPeers = []CarriedPeer{{PublicKey: "K1", Address: "192.0.2.5", Named: "printer"},
|
||||
{PublicKey: "K2", Address: "192.0.2.6", Named: "laptop"}, {PublicKey: "K3", Address: "192.0.2.7", Named: "late", EnrolledAs: "late"}}
|
||||
@@ -234,7 +234,7 @@ func TestACarriedPeerIsNamedUntilItEnrols(t *testing.T) {
|
||||
}
|
||||
|
||||
// A node-engine older than a contract is not sent the field it would refuse (novox/hq ADR 0240 and after).
|
||||
func TestTheNodeEnginesContractGatesWhatItIsSent(t *testing.T) {
|
||||
func testTheNodeEnginesContractGatesWhatItIsSent(t *testing.T) {
|
||||
in := aMesh(t)
|
||||
laptop := nodeOf(t, &in, "laptop")
|
||||
if r := placed(t, in, "laptop").Rendering; r.ReadsHealth || r.JudgesRoot || r.ReadsBusy || r.Hands {
|
||||
@@ -252,7 +252,7 @@ func TestTheNodeEnginesContractGatesWhatItIsSent(t *testing.T) {
|
||||
|
||||
// The artifact store as a node reaches it: over the private network by its holder's name and the port it put it on, or on loopback
|
||||
// for the holder alone while nothing is on the network (novox/hq 04-ISSUES/102).
|
||||
func TestTheArtifactStoreIsReachedOverTheNetworkOrOnLoopbackForItsHolder(t *testing.T) {
|
||||
func testTheArtifactStoreIsReachedOverTheNetworkOrOnLoopbackForItsHolder(t *testing.T) {
|
||||
in := aMesh(t)
|
||||
in.Catalogue["artifacts"] = catalogue.Manifest{Module: "artifacts", Version: "1",
|
||||
Claims: []catalogue.Claim{{Name: "container-image-registry", Scope: catalogue.ScopeMesh}},
|
||||
@@ -295,7 +295,7 @@ func TestTheArtifactStoreIsReachedOverTheNetworkOrOnLoopbackForItsHolder(t *test
|
||||
// The store's address is the image seat's holder's listen open to the mesh, on the port its node put it on, and every
|
||||
// name of the store answers it (novox/hq ADR 0632 §1): a module serving the retired provision artifact-store is no store,
|
||||
// and a holder opening two listens to the mesh says which is the store by no guess.
|
||||
func TestTheStoreIsFoundByTheImageSeatsHolderAndItsListen(t *testing.T) {
|
||||
func testTheStoreIsFoundByTheImageSeatsHolderAndItsListen(t *testing.T) {
|
||||
in := aMesh(t)
|
||||
in.Catalogue["old"] = catalogue.Manifest{Module: "old", Version: "1",
|
||||
Serves: map[string]map[string]any{catalogue.ArtifactStoreProvision: {"port": 5100}}}
|
||||
@@ -409,7 +409,7 @@ func TestTheStoreIsFoundByTheImageSeatsHolderAndItsListen(t *testing.T) {
|
||||
|
||||
// A zone a module declares is placed where the mesh put it: settled from that node's settings, at the node's private address, on
|
||||
// the port the answering listen is published on there (novox/hq ADR 0199); the same zone declared twice is refused, by name.
|
||||
func TestAZoneIsPlacedWhereTheMeshPutItAndTheSameZoneTwiceIsRefused(t *testing.T) {
|
||||
func testAZoneIsPlacedWhereTheMeshPutItAndTheSameZoneTwiceIsRefused(t *testing.T) {
|
||||
in := aMesh(t)
|
||||
lab := catalogue.Manifest{Module: "lab", Version: "1", Zone: &catalogue.Zone{Name: "${setting:zone}", Listen: "dns"},
|
||||
Listens: []catalogue.Listening{{Name: "dns", Port: 53, Protocol: "udp", From: catalogue.FromMesh}}}
|
||||
@@ -432,7 +432,7 @@ func TestAZoneIsPlacedWhereTheMeshPutItAndTheSameZoneTwiceIsRefused(t *testing.T
|
||||
|
||||
// Every holder of a replicated seat is listed by internal name at its private address (novox/hq ADR 0223): the holders on record,
|
||||
// and only the sole claimant when there are none; a holder off the private network is left out.
|
||||
func TestEveryHolderOfAReplicatedSeatIsListedOnTheNetwork(t *testing.T) {
|
||||
func testEveryHolderOfAReplicatedSeatIsListedOnTheNetwork(t *testing.T) {
|
||||
in := aMesh(t)
|
||||
resolver := catalogue.Manifest{Module: "resolver", Version: "1",
|
||||
Provides: []catalogue.Offer{{Name: "wildcard-resolution", Scope: catalogue.ScopeMesh}},
|
||||
@@ -460,3 +460,18 @@ func TestEveryHolderOfAReplicatedSeatIsListedOnTheNetwork(t *testing.T) {
|
||||
t.Errorf("a holder off the network is listed: %v", got)
|
||||
}
|
||||
}
|
||||
|
||||
// TestRendering runs this file's tests, each a subtest named as its function was (design 47 H2 §819, the test budget).
|
||||
func TestRendering(t *testing.T) {
|
||||
t.Run("AnAllocatedPortIsComposedAndAnUnallocatedOneIsNamedForeseenNotInvented", testAnAllocatedPortIsComposedAndAnUnallocatedOneIsNamedForeseenNotInvented)
|
||||
t.Run("APortTheOperatorGaveIsUsedAndNotReallocated", testAPortTheOperatorGaveIsUsedAndNotReallocated)
|
||||
t.Run("SeatsHeldAndTakenReachTheRendering", testSeatsHeldAndTakenReachTheRendering)
|
||||
t.Run("LocalNetworksAndOutwardLinksReachTheRendering", testLocalNetworksAndOutwardLinksReachTheRendering)
|
||||
t.Run("AccountsNamesAndTheOperatorsExportReachTheRendering", testAccountsNamesAndTheOperatorsExportReachTheRendering)
|
||||
t.Run("ACarriedPeerIsNamedUntilItEnrols", testACarriedPeerIsNamedUntilItEnrols)
|
||||
t.Run("TheNodeEnginesContractGatesWhatItIsSent", testTheNodeEnginesContractGatesWhatItIsSent)
|
||||
t.Run("TheArtifactStoreIsReachedOverTheNetworkOrOnLoopbackForItsHolder", testTheArtifactStoreIsReachedOverTheNetworkOrOnLoopbackForItsHolder)
|
||||
t.Run("TheStoreIsFoundByTheImageSeatsHolderAndItsListen", testTheStoreIsFoundByTheImageSeatsHolderAndItsListen)
|
||||
t.Run("AZoneIsPlacedWhereTheMeshPutItAndTheSameZoneTwiceIsRefused", testAZoneIsPlacedWhereTheMeshPutItAndTheSameZoneTwiceIsRefused)
|
||||
t.Run("EveryHolderOfAReplicatedSeatIsListedOnTheNetwork", testEveryHolderOfAReplicatedSeatIsListedOnTheNetwork)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user