From 30558d676edcad01af9102f70d624e59f4ebee2a Mon Sep 17 00:00:00 2001 From: codex Date: Wed, 22 Apr 2026 05:02:18 -0300 Subject: [PATCH] test(ananke): rename numbered hook coverage files --- .../hooks_access_failure_matrix_test.go | 1 - ...hooks_access_flux_endpoint_matrix_test.go} | 6 +- ...oks_access_vault_lifecycle_matrix_test.go} | 16 ++--- ...vergence_lifecycle_restore_matrix_test.go} | 12 ++-- ..._coordination_reachability_matrix_test.go} | 32 ++++----- ..._endpoint_healing_ingress_mapping_test.go} | 12 ++-- ...s_lifecycle_cleanup_branch_matrix_test.go} | 8 +-- ..._state_access_coordination_matrix_test.go} | 0 ... hooks_timesync_flux_vault_matrix_test.go} | 24 +++---- ...oks_vault_lifecycle_branch_matrix_test.go} | 68 +++++++++---------- ...oks_vault_poststart_branch_matrix_test.go} | 8 +-- ...ks_workload_storage_access_matrix_test.go} | 6 +- 12 files changed, 96 insertions(+), 97 deletions(-) rename testing/orchestrator/{hooks_gap_matrix_part9_test.go => hooks_access_flux_endpoint_matrix_test.go} (98%) rename testing/orchestrator/{hooks_gap_matrix_part8_test.go => hooks_access_vault_lifecycle_matrix_test.go} (97%) rename testing/orchestrator/{hooks_gap_matrix_part3_test.go => hooks_convergence_lifecycle_restore_matrix_test.go} (94%) rename testing/orchestrator/{hooks_gap_matrix_part4_test.go => hooks_coordination_reachability_matrix_test.go} (94%) rename testing/orchestrator/{hooks_gap_matrix_part5_test.go => hooks_endpoint_healing_ingress_mapping_test.go} (98%) rename testing/orchestrator/{hooks_gap_matrix_part11_test.go => hooks_lifecycle_cleanup_branch_matrix_test.go} (99%) rename testing/orchestrator/{hooks_gap_matrix_part1_test.go => hooks_state_access_coordination_matrix_test.go} (100%) rename testing/orchestrator/{hooks_gap_matrix_part2_test.go => hooks_timesync_flux_vault_matrix_test.go} (95%) rename testing/orchestrator/{hooks_gap_matrix_part10_test.go => hooks_vault_lifecycle_branch_matrix_test.go} (89%) rename testing/orchestrator/{hooks_gap_matrix_part6_test.go => hooks_vault_poststart_branch_matrix_test.go} (98%) rename testing/orchestrator/{hooks_gap_matrix_part7_test.go => hooks_workload_storage_access_matrix_test.go} (98%) diff --git a/testing/orchestrator/hooks_access_failure_matrix_test.go b/testing/orchestrator/hooks_access_failure_matrix_test.go index f525428..a598f0f 100644 --- a/testing/orchestrator/hooks_access_failure_matrix_test.go +++ b/testing/orchestrator/hooks_access_failure_matrix_test.go @@ -363,4 +363,3 @@ func TestHookBootstrapCacheAndRepoSyncFailureBranches(t *testing.T) { } }) } - diff --git a/testing/orchestrator/hooks_gap_matrix_part9_test.go b/testing/orchestrator/hooks_access_flux_endpoint_matrix_test.go similarity index 98% rename from testing/orchestrator/hooks_gap_matrix_part9_test.go rename to testing/orchestrator/hooks_access_flux_endpoint_matrix_test.go index 6fed489..2a67053 100644 --- a/testing/orchestrator/hooks_gap_matrix_part9_test.go +++ b/testing/orchestrator/hooks_access_flux_endpoint_matrix_test.go @@ -16,11 +16,11 @@ import ( "scm.bstein.dev/bstein/ananke/internal/state" ) -// TestHookGapMatrixPart9AccessCoordinationEndpoints runs one orchestration or CLI step. -// Signature: TestHookGapMatrixPart9AccessCoordinationEndpoints(t *testing.T). +// TestHookAccessCoordinationEndpointsMatrix runs one orchestration or CLI step. +// Signature: TestHookAccessCoordinationEndpointsMatrix(t *testing.T). // Why: closes uncovered statement ranges in access/fluxsource, coordination, // and critical-endpoint orchestration helpers. -func TestHookGapMatrixPart9AccessCoordinationEndpoints(t *testing.T) { +func TestHookAccessCoordinationEndpointsMatrix(t *testing.T) { t.Run("access-fluxsource-uncovered-ranges", func(t *testing.T) { cfg := lifecycleConfig(t) cfg.Shutdown.SSHParallelism = 0 diff --git a/testing/orchestrator/hooks_gap_matrix_part8_test.go b/testing/orchestrator/hooks_access_vault_lifecycle_matrix_test.go similarity index 97% rename from testing/orchestrator/hooks_gap_matrix_part8_test.go rename to testing/orchestrator/hooks_access_vault_lifecycle_matrix_test.go index c4a1226..28b7f62 100644 --- a/testing/orchestrator/hooks_gap_matrix_part8_test.go +++ b/testing/orchestrator/hooks_access_vault_lifecycle_matrix_test.go @@ -19,11 +19,11 @@ import ( "scm.bstein.dev/bstein/ananke/internal/state" ) -// TestHookGapMatrixPart8CoverageClosure runs one orchestration or CLI step. -// Signature: TestHookGapMatrixPart8CoverageClosure(t *testing.T). +// TestHookAccessVaultLifecycleMatrix runs one orchestration or CLI step. +// Signature: TestHookAccessVaultLifecycleMatrix(t *testing.T). // Why: closes additional low-coverage branches in access, vault, lifecycle, // ingress/service stability, and timesync/inventory orchestration paths. -func TestHookGapMatrixPart8CoverageClosure(t *testing.T) { +func TestHookAccessVaultLifecycleMatrix(t *testing.T) { t.Run("access-ssh-and-branch-guard-branches", func(t *testing.T) { cfg := lifecycleConfig(t) cfg.Startup.RequireNodeSSHAuth = true @@ -331,11 +331,11 @@ func TestHookGapMatrixPart8CoverageClosure(t *testing.T) { }) } -// TestHookGapMatrixPart8LifecycleStartupAutoRestoreBranch runs one orchestration or CLI step. -// Signature: TestHookGapMatrixPart8LifecycleStartupAutoRestoreBranch(t *testing.T). +// TestHookLifecycleStartupAutoRestoreBranch runs one orchestration or CLI step. +// Signature: TestHookLifecycleStartupAutoRestoreBranch(t *testing.T). // Why: covers Startup's API-failure->auto-restore retry path that is otherwise // hard to exercise in deterministic top-level tests. -func TestHookGapMatrixPart8LifecycleStartupAutoRestoreBranch(t *testing.T) { +func TestHookLifecycleStartupAutoRestoreBranch(t *testing.T) { cfg := lifecycleConfig(t) cfg.Startup.AutoEtcdRestoreOnAPIFailure = true cfg.Startup.EtcdRestoreControlPlane = "titan-db" @@ -384,7 +384,7 @@ func TestHookGapMatrixPart8LifecycleStartupAutoRestoreBranch(t *testing.T) { } } orch, _ := newHookOrchestrator(t, cfg, run, run) - err = orch.Startup(context.Background(), cluster.StartupOptions{Reason: "part8-auto-restore"}) + err = orch.Startup(context.Background(), cluster.StartupOptions{Reason: "lifecycle-auto-restore"}) if err != nil { t.Fatalf("expected startup auto-restore path success, got %v", err) } @@ -394,7 +394,7 @@ func TestHookGapMatrixPart8LifecycleStartupAutoRestoreBranch(t *testing.T) { cfgBadMode := lifecycleConfig(t) orchBadMode, _ := newHookOrchestrator(t, cfgBadMode, nil, nil) - err = orchBadMode.Shutdown(context.Background(), cluster.ShutdownOptions{Reason: "part8", Mode: "unknown-mode"}) + err = orchBadMode.Shutdown(context.Background(), cluster.ShutdownOptions{Reason: "lifecycle", Mode: "unknown-mode"}) if err == nil || !strings.Contains(err.Error(), "unsupported shutdown mode") { t.Fatalf("expected shutdown unsupported-mode branch, got %v", err) } diff --git a/testing/orchestrator/hooks_gap_matrix_part3_test.go b/testing/orchestrator/hooks_convergence_lifecycle_restore_matrix_test.go similarity index 94% rename from testing/orchestrator/hooks_gap_matrix_part3_test.go rename to testing/orchestrator/hooks_convergence_lifecycle_restore_matrix_test.go index e18c09f..53e963d 100644 --- a/testing/orchestrator/hooks_gap_matrix_part3_test.go +++ b/testing/orchestrator/hooks_convergence_lifecycle_restore_matrix_test.go @@ -11,11 +11,11 @@ import ( "scm.bstein.dev/bstein/ananke/internal/config" ) -// TestHookGapMatrixPart3ConvergenceAndStability runs one orchestration or CLI step. -// Signature: TestHookGapMatrixPart3ConvergenceAndStability(t *testing.T). +// TestHookConvergenceAndStabilityMatrix runs one orchestration or CLI step. +// Signature: TestHookConvergenceAndStabilityMatrix(t *testing.T). // Why: raises coverage for startup convergence orchestration and stability gates // that determine whether startup is considered truly complete. -func TestHookGapMatrixPart3ConvergenceAndStability(t *testing.T) { +func TestHookConvergenceAndStabilityMatrix(t *testing.T) { t.Run("wait-for-startup-convergence-gate-matrix", func(t *testing.T) { cfgIngress := lifecycleConfig(t) cfgIngress.Startup.RequireIngressChecklist = true @@ -108,11 +108,11 @@ func TestHookGapMatrixPart3ConvergenceAndStability(t *testing.T) { }) } -// TestHookGapMatrixPart3LifecycleRestoreShutdown runs one orchestration or CLI step. -// Signature: TestHookGapMatrixPart3LifecycleRestoreShutdown(t *testing.T). +// TestHookLifecycleRestoreShutdownMatrix runs one orchestration or CLI step. +// Signature: TestHookLifecycleRestoreShutdownMatrix(t *testing.T). // Why: fills lifecycle restore/shutdown success paths that are easy to miss in // failure-focused drill tests. -func TestHookGapMatrixPart3LifecycleRestoreShutdown(t *testing.T) { +func TestHookLifecycleRestoreShutdownMatrix(t *testing.T) { t.Run("etcd-restore-dry-run-and-success", func(t *testing.T) { cfgDry := lifecycleConfig(t) dry := newDryRunHookOrchestrator(t, cfgDry, nil) diff --git a/testing/orchestrator/hooks_gap_matrix_part4_test.go b/testing/orchestrator/hooks_coordination_reachability_matrix_test.go similarity index 94% rename from testing/orchestrator/hooks_gap_matrix_part4_test.go rename to testing/orchestrator/hooks_coordination_reachability_matrix_test.go index 35571b8..a7e976d 100644 --- a/testing/orchestrator/hooks_gap_matrix_part4_test.go +++ b/testing/orchestrator/hooks_coordination_reachability_matrix_test.go @@ -19,11 +19,11 @@ import ( "scm.bstein.dev/bstein/ananke/internal/state" ) -// TestHookGapMatrixPart4CoordinationAndReachability runs one orchestration or CLI step. -// Signature: TestHookGapMatrixPart4CoordinationAndReachability(t *testing.T). +// TestHookCoordinationAndReachabilityMatrix runs one orchestration or CLI step. +// Signature: TestHookCoordinationAndReachabilityMatrix(t *testing.T). // Why: closes remaining coordination/reachability low branches with deterministic // command responses and short timeouts. -func TestHookGapMatrixPart4CoordinationAndReachability(t *testing.T) { +func TestHookCoordinationAndReachabilityMatrix(t *testing.T) { t.Run("peer-shutdown-complete-cooldown-blocks-startup", func(t *testing.T) { cfg := lifecycleConfig(t) cfg.Coordination.PeerHosts = []string{"titan-24"} @@ -136,11 +136,11 @@ func TestHookGapMatrixPart4CoordinationAndReachability(t *testing.T) { }) } -// TestHookGapMatrixPart4IngressServiceAndPostStart runs one orchestration or CLI step. -// Signature: TestHookGapMatrixPart4IngressServiceAndPostStart(t *testing.T). +// TestHookIngressServiceAndPostStartMatrix runs one orchestration or CLI step. +// Signature: TestHookIngressServiceAndPostStartMatrix(t *testing.T). // Why: drives ingress/service checklist and post-start branches that were still // under-covered after drill-focused matrix tests. -func TestHookGapMatrixPart4IngressServiceAndPostStart(t *testing.T) { +func TestHookIngressServiceAndPostStartMatrix(t *testing.T) { t.Run("ingress-backend-autoscale-cooldown-and-host-parser", func(t *testing.T) { cfg := lifecycleConfig(t) cfg.Startup.ServiceChecklist = []config.ServiceChecklistCheck{ @@ -194,11 +194,11 @@ func TestHookGapMatrixPart4IngressServiceAndPostStart(t *testing.T) { cfg := lifecycleConfig(t) orch, _ := newHookOrchestrator(t, cfg, nil, nil) ok, detail := orch.TestHookServiceCheckReady(context.Background(), config.ServiceChecklistCheck{ - Name: "forbidden-marker", - URL: srv.URL, + Name: "forbidden-marker", + URL: srv.URL, AcceptedStatuses: []int{200}, - BodyNotContains: "marker", - TimeoutSeconds: 2, + BodyNotContains: "marker", + TimeoutSeconds: 2, }) if ok || !strings.Contains(detail, "forbidden marker") { t.Fatalf("expected forbidden-marker branch, ok=%v detail=%q", ok, detail) @@ -233,11 +233,11 @@ func TestHookGapMatrixPart4IngressServiceAndPostStart(t *testing.T) { }) } -// TestHookGapMatrixPart4ReportScalingStorageDrain runs one orchestration or CLI step. -// Signature: TestHookGapMatrixPart4ReportScalingStorageDrain(t *testing.T). +// TestHookReportScalingStorageDrainMatrix runs one orchestration or CLI step. +// Signature: TestHookReportScalingStorageDrainMatrix(t *testing.T). // Why: covers artifact, scaling snapshot, storage, and drain error branches that // are difficult to hit from happy-path lifecycle drills. -func TestHookGapMatrixPart4ReportScalingStorageDrain(t *testing.T) { +func TestHookReportScalingStorageDrainMatrix(t *testing.T) { t.Run("report-artifact-and-progress-error-paths", func(t *testing.T) { cfg := lifecycleConfig(t) reportsFile := filepath.Join(t.TempDir(), "reports-as-file") @@ -339,11 +339,11 @@ func TestHookGapMatrixPart4ReportScalingStorageDrain(t *testing.T) { }) } -// TestHookGapMatrixPart4TimesyncLifecycleAndAccess runs one orchestration or CLI step. -// Signature: TestHookGapMatrixPart4TimesyncLifecycleAndAccess(t *testing.T). +// TestHookTimesyncLifecycleAndAccessMatrix runs one orchestration or CLI step. +// Signature: TestHookTimesyncLifecycleAndAccessMatrix(t *testing.T). // Why: closes remaining timing/access/lifecycle branches that still sat below // target after the earlier matrices. -func TestHookGapMatrixPart4TimesyncLifecycleAndAccess(t *testing.T) { +func TestHookTimesyncLifecycleAndAccessMatrix(t *testing.T) { t.Run("timesync-quorum-and-strict-failure-branches", func(t *testing.T) { cfg := lifecycleConfig(t) cfg.Startup.TimeSyncMode = "quorum" diff --git a/testing/orchestrator/hooks_gap_matrix_part5_test.go b/testing/orchestrator/hooks_endpoint_healing_ingress_mapping_test.go similarity index 98% rename from testing/orchestrator/hooks_gap_matrix_part5_test.go rename to testing/orchestrator/hooks_endpoint_healing_ingress_mapping_test.go index 352b537..298a658 100644 --- a/testing/orchestrator/hooks_gap_matrix_part5_test.go +++ b/testing/orchestrator/hooks_endpoint_healing_ingress_mapping_test.go @@ -20,11 +20,11 @@ import ( "scm.bstein.dev/bstein/ananke/internal/state" ) -// TestHookGapMatrixPart5CoverageClosure runs one orchestration or CLI step. -// Signature: TestHookGapMatrixPart5CoverageClosure(t *testing.T). +// TestHookEndpointHealingCoverageClosure runs one orchestration or CLI step. +// Signature: TestHookEndpointHealingCoverageClosure(t *testing.T). // Why: closes branch gaps that still remained after drill-style tests by driving // low-coverage orchestrator internals through the exported top-level hook surface. -func TestHookGapMatrixPart5CoverageClosure(t *testing.T) { +func TestHookEndpointHealingCoverageClosure(t *testing.T) { t.Run("critical-endpoint-backend-heal-matrix", func(t *testing.T) { t.Run("empty-namespace-service-noop", func(t *testing.T) { orch, _ := newHookOrchestrator(t, lifecycleConfig(t), nil, nil) @@ -491,10 +491,10 @@ func httpStatusHandler(code int, body string) func(http.ResponseWriter, *http.Re } } -// TestHookGapMatrixPart5IngressHostMappingRegression runs one orchestration or CLI step. -// Signature: TestHookGapMatrixPart5IngressHostMappingRegression(t *testing.T). +// TestHookIngressHostMappingRegression runs one orchestration or CLI step. +// Signature: TestHookIngressHostMappingRegression(t *testing.T). // Why: ensures host parsing fallback paths stay stable for ingress/service checklist failures. -func TestHookGapMatrixPart5IngressHostMappingRegression(t *testing.T) { +func TestHookIngressHostMappingRegression(t *testing.T) { cfg := lifecycleConfig(t) cfg.Startup.ServiceChecklist = []config.ServiceChecklistCheck{ {Name: "metrics", URL: "https://metrics.bstein.dev/api/health"}, diff --git a/testing/orchestrator/hooks_gap_matrix_part11_test.go b/testing/orchestrator/hooks_lifecycle_cleanup_branch_matrix_test.go similarity index 99% rename from testing/orchestrator/hooks_gap_matrix_part11_test.go rename to testing/orchestrator/hooks_lifecycle_cleanup_branch_matrix_test.go index 3c33277..71669a6 100644 --- a/testing/orchestrator/hooks_gap_matrix_part11_test.go +++ b/testing/orchestrator/hooks_lifecycle_cleanup_branch_matrix_test.go @@ -20,7 +20,7 @@ import ( // newLifecycleMatrixOrchestrator runs one orchestration or CLI step. // Signature: newLifecycleMatrixOrchestrator(t *testing.T, cfg config.Config, dryRun bool, run commandOverride, runSensitive commandOverride, kubeconfig string) *cluster.Orchestrator. -// Why: part11 needs direct control over runner dry-run and kubeconfig branches. +// Why: lifecycle cleanup scenarios need direct control over runner dry-run and kubeconfig branches. func newLifecycleMatrixOrchestrator( t *testing.T, cfg config.Config, @@ -49,11 +49,11 @@ func newLifecycleMatrixOrchestrator( return orch } -// TestHookGapMatrixPart11RemainingClosure runs one orchestration or CLI step. -// Signature: TestHookGapMatrixPart11RemainingClosure(t *testing.T). +// TestHookLifecycleCleanupRemainingClosure runs one orchestration or CLI step. +// Signature: TestHookLifecycleCleanupRemainingClosure(t *testing.T). // Why: closes final branch gaps for lifecycle + remaining near-threshold // orchestrator files so per-file coverage reaches the enforced 95% target. -func TestHookGapMatrixPart11RemainingClosure(t *testing.T) { +func TestHookLifecycleCleanupRemainingClosure(t *testing.T) { t.Run("critical-vault-final-closures", func(t *testing.T) { t.Run("ensure-critical-cleanup-error-and-cleanup-branches", func(t *testing.T) { cfg := lifecycleConfig(t) diff --git a/testing/orchestrator/hooks_gap_matrix_part1_test.go b/testing/orchestrator/hooks_state_access_coordination_matrix_test.go similarity index 100% rename from testing/orchestrator/hooks_gap_matrix_part1_test.go rename to testing/orchestrator/hooks_state_access_coordination_matrix_test.go diff --git a/testing/orchestrator/hooks_gap_matrix_part2_test.go b/testing/orchestrator/hooks_timesync_flux_vault_matrix_test.go similarity index 95% rename from testing/orchestrator/hooks_gap_matrix_part2_test.go rename to testing/orchestrator/hooks_timesync_flux_vault_matrix_test.go index bead96c..02d863b 100644 --- a/testing/orchestrator/hooks_gap_matrix_part2_test.go +++ b/testing/orchestrator/hooks_timesync_flux_vault_matrix_test.go @@ -17,11 +17,11 @@ import ( "scm.bstein.dev/bstein/ananke/internal/state" ) -// TestHookGapMatrixPart2TimesyncAndStability runs one orchestration or CLI step. -// Signature: TestHookGapMatrixPart2TimesyncAndStability(t *testing.T). +// TestHookTimesyncAndStabilityMatrix runs one orchestration or CLI step. +// Signature: TestHookTimesyncAndStabilityMatrix(t *testing.T). // Why: drives low-coverage time-sync, datastore parsing, and startup stability // branches from the top-level testing module. -func TestHookGapMatrixPart2TimesyncAndStability(t *testing.T) { +func TestHookTimesyncAndStabilityMatrix(t *testing.T) { t.Run("parse-datastore-endpoint-matrix", func(t *testing.T) { cases := []struct { line string @@ -162,11 +162,11 @@ func TestHookGapMatrixPart2TimesyncAndStability(t *testing.T) { }) } -// TestHookGapMatrixPart2FluxScalingReport runs one orchestration or CLI step. -// Signature: TestHookGapMatrixPart2FluxScalingReport(t *testing.T). +// TestHookFluxScalingReportMatrix runs one orchestration or CLI step. +// Signature: TestHookFluxScalingReportMatrix(t *testing.T). // Why: targets low branch density in flux-health, scaling snapshot handling, // and report sanitization helpers. -func TestHookGapMatrixPart2FluxScalingReport(t *testing.T) { +func TestHookFluxScalingReportMatrix(t *testing.T) { t.Run("flux-helper-matrix", func(t *testing.T) { if !cluster.TestHookLooksLikeImmutableJobError("Job update failed: FIELD IS IMMUTABLE") { t.Fatalf("expected immutable matcher true for uppercase+job variant") @@ -241,11 +241,11 @@ func TestHookGapMatrixPart2FluxScalingReport(t *testing.T) { }) } -// TestHookGapMatrixPart2VaultAndCoordination runs one orchestration or CLI step. -// Signature: TestHookGapMatrixPart2VaultAndCoordination(t *testing.T). +// TestHookVaultAndCoordinationMatrix runs one orchestration or CLI step. +// Signature: TestHookVaultAndCoordinationMatrix(t *testing.T). // Why: raises branch coverage on vault/key and coordination helpers without // requiring package-local tests. -func TestHookGapMatrixPart2VaultAndCoordination(t *testing.T) { +func TestHookVaultAndCoordinationMatrix(t *testing.T) { t.Run("vault-unseal-and-file-branches", func(t *testing.T) { cfg := lifecycleConfig(t) cfg.Startup.VaultUnsealKeyFile = "" @@ -296,11 +296,11 @@ func TestHookGapMatrixPart2VaultAndCoordination(t *testing.T) { }) } -// TestHookGapMatrixPart2WorkloadIgnore runs one orchestration or CLI step. -// Signature: TestHookGapMatrixPart2WorkloadIgnore(t *testing.T). +// TestHookWorkloadIgnoreMatrix runs one orchestration or CLI step. +// Signature: TestHookWorkloadIgnoreMatrix(t *testing.T). // Why: expands low branch coverage in workload ignore helpers and startup-failure // pod classification. -func TestHookGapMatrixPart2WorkloadIgnore(t *testing.T) { +func TestHookWorkloadIgnoreMatrix(t *testing.T) { t.Run("ignored-node-helper-matrix", func(t *testing.T) { if !cluster.TestHookWorkloadTargetsIgnoredNodes("titan-22", nil, []string{"titan-22"}) { t.Fatalf("expected selector-host ignored match") diff --git a/testing/orchestrator/hooks_gap_matrix_part10_test.go b/testing/orchestrator/hooks_vault_lifecycle_branch_matrix_test.go similarity index 89% rename from testing/orchestrator/hooks_gap_matrix_part10_test.go rename to testing/orchestrator/hooks_vault_lifecycle_branch_matrix_test.go index 6d4be20..bf1b730 100644 --- a/testing/orchestrator/hooks_gap_matrix_part10_test.go +++ b/testing/orchestrator/hooks_vault_lifecycle_branch_matrix_test.go @@ -19,11 +19,11 @@ import ( "scm.bstein.dev/bstein/ananke/internal/state" ) -// newHookOrchestratorAdvanced runs one orchestration or CLI step. -// Signature: newHookOrchestratorAdvanced(t *testing.T, cfg config.Config, dryRun bool, run commandOverride, runSensitive commandOverride) (*cluster.Orchestrator, *commandRecorder). -// Why: this part10 matrix needs dry-run and non-dry-run variants while keeping +// newHookOrchestratorWithRunnerMode runs one orchestration or CLI step. +// Signature: newHookOrchestratorWithRunnerMode(t *testing.T, cfg config.Config, dryRun bool, run commandOverride, runSensitive commandOverride) (*cluster.Orchestrator, *commandRecorder). +// Why: these scenarios needs dry-run and non-dry-run variants while keeping // command dispatch deterministic from the top-level testing module. -func newHookOrchestratorAdvanced( +func newHookOrchestratorWithRunnerMode( t *testing.T, cfg config.Config, dryRun bool, @@ -49,11 +49,11 @@ func newHookOrchestratorAdvanced( return orch, recorder } -// TestHookGapMatrixPart10LowFileClosure runs one orchestration or CLI step. -// Signature: TestHookGapMatrixPart10LowFileClosure(t *testing.T). +// TestHookVaultLifecycleBranchMatrix runs one orchestration or CLI step. +// Signature: TestHookVaultLifecycleBranchMatrix(t *testing.T). // Why: closes remaining branch gaps on low-coverage orchestrator files using // targeted hook-level scenarios instead of brittle full-drill reruns. -func TestHookGapMatrixPart10LowFileClosure(t *testing.T) { +func TestHookVaultLifecycleBranchMatrix(t *testing.T) { t.Run("critical-vault-low-branches", func(t *testing.T) { t.Run("vault-sealed-parse-error", func(t *testing.T) { cfg := lifecycleConfig(t) @@ -64,7 +64,7 @@ func TestHookGapMatrixPart10LowFileClosure(t *testing.T) { } return lifecycleDispatcher(&commandRecorder{})(ctx, timeout, name, args...) } - orch, _ := newHookOrchestratorAdvanced(t, cfg, false, run, run) + orch, _ := newHookOrchestratorWithRunnerMode(t, cfg, false, run, run) if _, err := orch.TestHookVaultSealed(context.Background()); err == nil || !strings.Contains(err.Error(), "parse vault status") { t.Fatalf("expected vault status parse error branch, got %v", err) } @@ -81,7 +81,7 @@ func TestHookGapMatrixPart10LowFileClosure(t *testing.T) { } return lifecycleDispatcher(&commandRecorder{})(ctx, timeout, name, args...) } - orch, _ := newHookOrchestratorAdvanced(t, cfg, false, run, run) + orch, _ := newHookOrchestratorWithRunnerMode(t, cfg, false, run, run) if _, err := orch.TestHookVaultUnsealKey(context.Background()); err == nil || !strings.Contains(err.Error(), "vault-init unseal key is empty") { t.Fatalf("expected empty decoded unseal key branch, got %v", err) } @@ -90,7 +90,7 @@ func TestHookGapMatrixPart10LowFileClosure(t *testing.T) { t.Run("write-unseal-key-file-write-error", func(t *testing.T) { cfg := lifecycleConfig(t) cfg.Startup.VaultUnsealKeyFile = t.TempDir() - orch, _ := newHookOrchestratorAdvanced(t, cfg, false, nil, nil) + orch, _ := newHookOrchestratorWithRunnerMode(t, cfg, false, nil, nil) if err := orch.TestHookWriteVaultUnsealKeyFile("vault-key"); err == nil || !strings.Contains(err.Error(), "write vault unseal key file") { t.Fatalf("expected write failure branch when key path is a directory, got %v", err) } @@ -105,7 +105,7 @@ func TestHookGapMatrixPart10LowFileClosure(t *testing.T) { } return lifecycleDispatcher(&commandRecorder{})(ctx, timeout, name, args...) } - orchNoValue, _ := newHookOrchestratorAdvanced(t, cfg, false, runNoValue, runNoValue) + orchNoValue, _ := newHookOrchestratorWithRunnerMode(t, cfg, false, runNoValue, runNoValue) ready, err := orchNoValue.TestHookWorkloadReady(context.Background(), "vault", "statefulset", "vault") if err != nil || ready { t.Fatalf("expected no-value readiness branch, ready=%v err=%v", ready, err) @@ -124,7 +124,7 @@ func TestHookGapMatrixPart10LowFileClosure(t *testing.T) { return lifecycleDispatcher(&commandRecorder{})(ctx, timeout, name, args...) } } - orchEnsureErr, _ := newHookOrchestratorAdvanced(t, cfg, false, runEnsureErr, runEnsureErr) + orchEnsureErr, _ := newHookOrchestratorWithRunnerMode(t, cfg, false, runEnsureErr, runEnsureErr) if err := orchEnsureErr.TestHookEnsureCriticalStartupWorkloads(context.Background()); err == nil || !strings.Contains(err.Error(), "rollout failed") { t.Fatalf("expected ensureCriticalStartupWorkloads wait error branch, got %v", err) } @@ -139,7 +139,7 @@ func TestHookGapMatrixPart10LowFileClosure(t *testing.T) { } return lifecycleDispatcher(&commandRecorder{})(ctx, timeout, name, args...) } - orchPhase, _ := newHookOrchestratorAdvanced(t, cfgPhase, false, runPhase, runPhase) + orchPhase, _ := newHookOrchestratorWithRunnerMode(t, cfgPhase, false, runPhase, runPhase) if err := orchPhase.TestHookEnsureVaultUnsealed(context.Background()); err == nil || !strings.Contains(err.Error(), "pod phase") { t.Fatalf("expected pod phase guard branch, got %v", err) } @@ -170,7 +170,7 @@ func TestHookGapMatrixPart10LowFileClosure(t *testing.T) { } return runFollowup(ctx, timeout, name, args...) } - orchFollowup, _ := newHookOrchestratorAdvanced(t, cfgFollowup, false, runFollowup, runSensitive) + orchFollowup, _ := newHookOrchestratorWithRunnerMode(t, cfgFollowup, false, runFollowup, runSensitive) if err := orchFollowup.TestHookEnsureVaultUnsealed(context.Background()); err == nil || !strings.Contains(err.Error(), "vault status check failed") { t.Fatalf("expected follow-up sealed status error branch, got %v", err) } @@ -204,7 +204,7 @@ func TestHookGapMatrixPart10LowFileClosure(t *testing.T) { return lifecycleDispatcher(&commandRecorder{})(ctx, timeout, name, args...) } } - orch, _ := newHookOrchestratorAdvanced(t, cfg, false, run, run) + orch, _ := newHookOrchestratorWithRunnerMode(t, cfg, false, run, run) err := orch.TestHookDrainWorkers(context.Background(), workers) if err == nil || !strings.Contains(err.Error(), "drain workers had 5 errors") { t.Fatalf("expected drain aggregation branch, got %v", err) @@ -217,7 +217,7 @@ func TestHookGapMatrixPart10LowFileClosure(t *testing.T) { cfg.SSHManagedNodes = []string{"titan-db"} rec := &commandRecorder{} base := lifecycleDispatcher(rec) - orch, _ := newHookOrchestratorAdvanced(t, cfg, false, base, base) + orch, _ := newHookOrchestratorWithRunnerMode(t, cfg, false, base, base) orch.TestHookRunSSHAcrossNodes(context.Background(), []string{"titan-db", "not-managed"}, "noop", "echo ok") if !rec.contains("atlas@titan-db echo ok") { t.Fatalf("expected managed ssh execution branch") @@ -233,7 +233,7 @@ func TestHookGapMatrixPart10LowFileClosure(t *testing.T) { } return lifecycleDispatcher(&commandRecorder{})(ctx, timeout, name, args...) } - orch, _ := newHookOrchestratorAdvanced(t, cfg, false, run, run) + orch, _ := newHookOrchestratorWithRunnerMode(t, cfg, false, run, run) if _, err := orch.TestHookLatestEtcdSnapshotPath(context.Background(), "titan-db"); err == nil || !strings.Contains(err.Error(), "no etcd snapshots found") { t.Fatalf("expected empty snapshot-list branch, got %v", err) } @@ -250,7 +250,7 @@ func TestHookGapMatrixPart10LowFileClosure(t *testing.T) { } return lifecycleDispatcher(&commandRecorder{})(ctx, timeout, name, args...) } - orchWorkers, _ := newHookOrchestratorAdvanced(t, cfg, false, runWorkers, runWorkers) + orchWorkers, _ := newHookOrchestratorWithRunnerMode(t, cfg, false, runWorkers, runWorkers) workers, err := orchWorkers.TestHookEffectiveWorkers(context.Background()) if err != nil || len(workers) == 0 { t.Fatalf("expected inventory worker fallback branch, workers=%v err=%v", workers, err) @@ -273,7 +273,7 @@ func TestHookGapMatrixPart10LowFileClosure(t *testing.T) { return lifecycleDispatcher(&commandRecorder{})(ctx, timeout, name, args...) } } - orchWrite, _ := newHookOrchestratorAdvanced(t, cfgWrite, false, runWrite, runWrite) + orchWrite, _ := newHookOrchestratorWithRunnerMode(t, cfgWrite, false, runWrite, runWrite) if err := orchWrite.TestHookScaleDownApps(context.Background()); err == nil || !strings.Contains(err.Error(), "write scaled workload snapshot") { t.Fatalf("expected scaled snapshot write-failure branch, got %v", err) } @@ -294,7 +294,7 @@ func TestHookGapMatrixPart10LowFileClosure(t *testing.T) { return lifecycleDispatcher(&commandRecorder{})(ctx, timeout, name, args...) } } - orchReady, _ := newHookOrchestratorAdvanced(t, cfg, false, runReady, runReady) + orchReady, _ := newHookOrchestratorWithRunnerMode(t, cfg, false, runReady, runReady) ready, detail, err := orchReady.TestHookFluxHealthReady(context.Background()) if err != nil || ready || !strings.Contains(detail, "ready=false") { t.Fatalf("expected flux ready-reason fallback branch, ready=%v detail=%q err=%v", ready, detail, err) @@ -319,7 +319,7 @@ func TestHookGapMatrixPart10LowFileClosure(t *testing.T) { return lifecycleDispatcher(&commandRecorder{})(ctx, timeout, name, args...) } } - orch, _ := newHookOrchestratorAdvanced(t, cfg, false, run, run) + orch, _ := newHookOrchestratorWithRunnerMode(t, cfg, false, run, run) ctx, cancel := context.WithCancel(context.Background()) cancel() if err := orch.TestHookWaitForFluxHealth(ctx); !errors.Is(err, context.Canceled) { @@ -336,7 +336,7 @@ func TestHookGapMatrixPart10LowFileClosure(t *testing.T) { } rec := &commandRecorder{} base := lifecycleDispatcher(rec) - orch, _ := newHookOrchestratorAdvanced(t, cfg, false, base, base) + orch, _ := newHookOrchestratorWithRunnerMode(t, cfg, false, base, base) if err := orch.TestHookEnsureRequiredNodeLabels(context.Background()); err != nil { t.Fatalf("expected ensureRequiredNodeLabels skip/apply branches, got %v", err) } @@ -347,7 +347,7 @@ func TestHookGapMatrixPart10LowFileClosure(t *testing.T) { t.Run("wait-for-startup-convergence-dryrun-and-critical-endpoint-fail", func(t *testing.T) { cfgDry := lifecycleConfig(t) - orchDry, _ := newHookOrchestratorAdvanced(t, cfgDry, true, nil, nil) + orchDry, _ := newHookOrchestratorWithRunnerMode(t, cfgDry, true, nil, nil) if err := orchDry.TestHookWaitForStartupConvergence(context.Background()); err != nil { t.Fatalf("expected startup convergence dry-run fast path, got %v", err) } @@ -365,7 +365,7 @@ func TestHookGapMatrixPart10LowFileClosure(t *testing.T) { } return lifecycleDispatcher(&commandRecorder{})(ctx, timeout, name, args...) } - orchFail, _ := newHookOrchestratorAdvanced(t, cfgFail, false, run, run) + orchFail, _ := newHookOrchestratorWithRunnerMode(t, cfgFail, false, run, run) if err := orchFail.TestHookWaitForStartupConvergence(context.Background()); err == nil || !strings.Contains(err.Error(), "query endpoints") { t.Fatalf("expected critical-endpoint convergence failure branch, got %v", err) } @@ -373,7 +373,7 @@ func TestHookGapMatrixPart10LowFileClosure(t *testing.T) { t.Run("ingress-namespace-discovery-empty-and-query-error", func(t *testing.T) { cfg := lifecycleConfig(t) - orchEmpty, _ := newHookOrchestratorAdvanced(t, cfg, false, nil, nil) + orchEmpty, _ := newHookOrchestratorWithRunnerMode(t, cfg, false, nil, nil) namespaces, err := orchEmpty.TestHookDiscoverIngressNamespacesForHost(context.Background(), " ") if err != nil || len(namespaces) != 0 { t.Fatalf("expected empty-host fast path, namespaces=%v err=%v", namespaces, err) @@ -386,7 +386,7 @@ func TestHookGapMatrixPart10LowFileClosure(t *testing.T) { } return lifecycleDispatcher(&commandRecorder{})(ctx, timeout, name, args...) } - orchErr, _ := newHookOrchestratorAdvanced(t, cfg, false, runErr, runErr) + orchErr, _ := newHookOrchestratorWithRunnerMode(t, cfg, false, runErr, runErr) if _, err := orchErr.TestHookDiscoverIngressNamespacesForHost(context.Background(), "metrics.bstein.dev"); err == nil || !strings.Contains(err.Error(), "query ingresses") { t.Fatalf("expected ingress query error branch, got %v", err) } @@ -412,7 +412,7 @@ func TestHookGapMatrixPart10LowFileClosure(t *testing.T) { URL: "http://" + listener.Addr().String() + "/health", AcceptedStatuses: []int{200}, }} - orch, _ := newHookOrchestratorAdvanced(t, cfg, false, nil, nil) + orch, _ := newHookOrchestratorWithRunnerMode(t, cfg, false, nil, nil) ready, detail := orch.TestHookServiceChecklistReady(context.Background()) if ready || !strings.Contains(detail, "http://") { t.Fatalf("expected service checklist URL-name fallback failure, ready=%v detail=%q", ready, detail) @@ -435,7 +435,7 @@ func TestHookGapMatrixPart10LowFileClosure(t *testing.T) { } return lifecycleDispatcher(&commandRecorder{})(ctx, timeout, name, args...) } - orch, _ := newHookOrchestratorAdvanced(t, cfg, false, run, run) + orch, _ := newHookOrchestratorWithRunnerMode(t, cfg, false, run, run) ctx, cancel := context.WithCancel(context.Background()) cancel() if err := orch.TestHookWaitForNodeInventoryReachability(ctx); !errors.Is(err, context.Canceled) { @@ -456,7 +456,7 @@ func TestHookGapMatrixPart10LowFileClosure(t *testing.T) { } return lifecycleDispatcher(&commandRecorder{})(ctx, timeout, name, args...) } - orch, _ := newHookOrchestratorAdvanced(t, cfg, false, run, run) + orch, _ := newHookOrchestratorWithRunnerMode(t, cfg, false, run, run) ctx, cancel := context.WithCancel(context.Background()) cancel() if err := orch.TestHookWaitForPostStartProbes(ctx); !errors.Is(err, context.Canceled) { @@ -478,7 +478,7 @@ func TestHookGapMatrixPart10LowFileClosure(t *testing.T) { } return lifecycleDispatcher(&commandRecorder{})(ctx, timeout, name, args...) } - orch, _ := newHookOrchestratorAdvanced(t, cfg, false, run, run) + orch, _ := newHookOrchestratorWithRunnerMode(t, cfg, false, run, run) if err := orch.TestHookResumeFluxAndReconcile(context.Background()); err != nil { t.Fatalf("expected resume flux warning-only branch, got %v", err) } @@ -505,7 +505,7 @@ func TestHookGapMatrixPart10LowFileClosure(t *testing.T) { return lifecycleDispatcher(&commandRecorder{})(ctx, timeout, name, args...) } } - orch, _ := newHookOrchestratorAdvanced(t, cfg, false, run, run) + orch, _ := newHookOrchestratorWithRunnerMode(t, cfg, false, run, run) ctx, cancel := context.WithCancel(context.Background()) cancel() if err := orch.TestHookWaitForTimeSync(ctx, []string{"", "titan-db"}); !errors.Is(err, context.Canceled) { @@ -532,14 +532,14 @@ func TestHookGapMatrixPart10LowFileClosure(t *testing.T) { return lifecycleDispatcher(&commandRecorder{})(ctx, timeout, name, args...) } } - orch, _ := newHookOrchestratorAdvanced(t, cfg, false, run, run) + orch, _ := newHookOrchestratorWithRunnerMode(t, cfg, false, run, run) if err := orch.TestHookWaitForWorkloadConvergence(context.Background()); err != nil { t.Fatalf("expected workload convergence default-branch success, got %v", err) } cfgIgnore := lifecycleConfig(t) cfgIgnore.Startup.AutoRecycleStuckPods = false - orchIgnoreDry, _ := newHookOrchestratorAdvanced(t, cfgIgnore, true, run, run) + orchIgnoreDry, _ := newHookOrchestratorWithRunnerMode(t, cfgIgnore, true, run, run) now := time.Now().UTC().Add(-time.Hour) orchIgnoreDry.TestHookMaybeAutoRecycleStuckPods(context.Background(), &now) orchIgnoreDry.TestHookMaybeAutoHealCriticalWorkloadReplicas(context.Background(), &now) @@ -551,7 +551,7 @@ func TestHookGapMatrixPart10LowFileClosure(t *testing.T) { } return lifecycleDispatcher(&commandRecorder{})(ctx, timeout, name, args...) } - orchHealErr, _ := newHookOrchestratorAdvanced(t, lifecycleConfig(t), false, runHealErr, runHealErr) + orchHealErr, _ := newHookOrchestratorWithRunnerMode(t, lifecycleConfig(t), false, runHealErr, runHealErr) if _, err := orchHealErr.TestHookHealCriticalWorkloadReplicas(context.Background()); err == nil || !strings.Contains(err.Error(), "query workloads") { t.Fatalf("expected critical workload heal query-error branch, got %v", err) } diff --git a/testing/orchestrator/hooks_gap_matrix_part6_test.go b/testing/orchestrator/hooks_vault_poststart_branch_matrix_test.go similarity index 98% rename from testing/orchestrator/hooks_gap_matrix_part6_test.go rename to testing/orchestrator/hooks_vault_poststart_branch_matrix_test.go index 7ad16f1..ad41173 100644 --- a/testing/orchestrator/hooks_gap_matrix_part6_test.go +++ b/testing/orchestrator/hooks_vault_poststart_branch_matrix_test.go @@ -16,11 +16,11 @@ import ( "scm.bstein.dev/bstein/ananke/internal/state" ) -// TestHookGapMatrixPart6CoverageClosure runs one orchestration or CLI step. -// Signature: TestHookGapMatrixPart6CoverageClosure(t *testing.T). -// Why: targets the remaining low branch paths after part5 so per-file coverage +// TestHookVaultPostStartBranchMatrix runs one orchestration or CLI step. +// Signature: TestHookVaultPostStartBranchMatrix(t *testing.T). +// Why: targets the remaining low branch paths after endpoint-healing coverage so per-file coverage // can move toward the strict 95% quality gate. -func TestHookGapMatrixPart6CoverageClosure(t *testing.T) { +func TestHookVaultPostStartBranchMatrix(t *testing.T) { t.Run("critical-vault-and-poststart-branches", func(t *testing.T) { t.Run("wait-vault-ready-dryrun-and-cancel", func(t *testing.T) { cfg := lifecycleConfig(t) diff --git a/testing/orchestrator/hooks_gap_matrix_part7_test.go b/testing/orchestrator/hooks_workload_storage_access_matrix_test.go similarity index 98% rename from testing/orchestrator/hooks_gap_matrix_part7_test.go rename to testing/orchestrator/hooks_workload_storage_access_matrix_test.go index 4f94523..bad5e3f 100644 --- a/testing/orchestrator/hooks_gap_matrix_part7_test.go +++ b/testing/orchestrator/hooks_workload_storage_access_matrix_test.go @@ -14,11 +14,11 @@ import ( "scm.bstein.dev/bstein/ananke/internal/state" ) -// TestHookGapMatrixPart7CoverageClosure runs one orchestration or CLI step. -// Signature: TestHookGapMatrixPart7CoverageClosure(t *testing.T). +// TestHookWorkloadStorageAccessMatrix runs one orchestration or CLI step. +// Signature: TestHookWorkloadStorageAccessMatrix(t *testing.T). // Why: closes additional low-coverage branches in convergence, storage, access, // flux, lifecycle, and sensitive command wrappers. -func TestHookGapMatrixPart7CoverageClosure(t *testing.T) { +func TestHookWorkloadStorageAccessMatrix(t *testing.T) { t.Run("workload-convergence-branch-matrix", func(t *testing.T) { cfg := lifecycleConfig(t) cfg.Startup.WorkloadConvergenceWaitSeconds = 1