From ee017fe30661b98a3c58566091eb6818b53c4ac2 Mon Sep 17 00:00:00 2001 From: jochen Date: Fri, 20 Nov 2026 02:41:48 +0100 Subject: [PATCH] MH-6: the test budget: three pairs of tests covering one rule twice become subtests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unit test functions: 1,719 before H1, 1,717 after (three fewer by the merges, one added for the claims read); integration tests: 10 before, 11 after (budget 50). The module stays over the unit budget of 500. Builds: design 47 H ยง774 Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy --- internal/agent/agent_test.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/agent/agent_test.go b/internal/agent/agent_test.go index f7b5cd1e..65a32c23 100644 --- a/internal/agent/agent_test.go +++ b/internal/agent/agent_test.go @@ -373,10 +373,11 @@ func TestStartingOnWhatTheKeptDeclarationHoldsAppliesNothing(t *testing.T) { if got := b.appliedList(); len(got) != 0 { t.Fatalf("a module that already runs what the want names was applied: %v", got) } + t.Run("starting on its own have applies nothing", testStartingOnItsOwnHaveAppliesNothing) } // What the node-engine itself last applied is what runs after a restart, not the kept declaration. -func TestStartingOnItsOwnHaveAppliesNothing(t *testing.T) { +func testStartingOnItsOwnHaveAppliesNothing(t *testing.T) { t.Run("1957: an engine start reads the machine's facts", testAnEngineStartReconcilesAModuleFromTheMachinesFacts) t.Run("says the have again", testStartingOnItsOwnHaveSaysTheHaveAgainSoItsHealthIsThisEngines) // An apply that failed is not what runs, though its have names the want's build and digest: the agent starting on @@ -698,6 +699,7 @@ func TestAFailedApplyIsRetriedOnlyByAChangeOfEitherKey(t *testing.T) { } }) } + t.Run("a failed apply is applied again after a restart, whatever is kept", testAFailedApplyIsAppliedAgainAfterARestartWhateverIsKept) } // R6-A AC5: a data module that ran before asks its backup before any resource changes; a refusal holds it, nothing is @@ -1111,6 +1113,7 @@ func TestApplyingOneModuleHoldsOutTheModulesStillRunningFromTheKeptDeclaration(t if len(names) != 2 || !strings.Contains(strings.Join(names, ","), "db") { t.Fatalf("the others of web were %v: db and the node's own run from the kept declaration", names) } + t.Run("the node's own apply holds out a module that moved to its own composition", testTheNodesOwnApplyHoldsOutAModuleThatMovedToItsOwnComposition) } // Everything is what runs: the agent's compositions and the kept resources of each module it does not hold. @@ -1297,7 +1300,7 @@ func (m *memApplied) get(module string) []byte { // A failed apply is applied again after a restart even when the kept declaration holds the composition: once this // node-engine wrote its haves, they are what it knows (the kept declaration is only for the first start after the switch). -func TestAFailedApplyIsAppliedAgainAfterARestartWhateverIsKept(t *testing.T) { +func testAFailedApplyIsAppliedAgainAfterARestartWhateverIsKept(t *testing.T) { b := newBed(t) fp := fpOf("a") ck, craw, dig := composition(t, "web", fp, false, file("web", "x", "1")) @@ -1335,7 +1338,7 @@ func TestAHaveWithNoCompositionDefersToTheKeptDeclaration(t *testing.T) { // run yet (issue 1945, live on 2026-10-25 at 02:32: shanks' node-engine applied a node's own composition that no longer // carried systemd-resolved, whose own composition waited for its credential, and removed its guard, so the machine lost // its resolver). -func TestTheNodesOwnApplyHoldsOutAModuleThatMovedToItsOwnComposition(t *testing.T) { +func testTheNodesOwnApplyHoldsOutAModuleThatMovedToItsOwnComposition(t *testing.T) { b := newBed(t) fp := fpOf("b") // systemd-resolved's own composition is written; no want names it yet.