Category
Missing tests
Description
runE is ~450 lines handling config loading, audit init, workload planning, service creation, secret creation, VM creation, readiness waiting, and summary printing. cleanupE is ~140 lines with similar breadth. These are the riskiest functions in the codebase and the hardest to test.
All internal packages have 84-96% coverage, but cmd/virtwork sits at 1.3%. The E2E tests provide some coverage but require a live cluster. There are no unit-level tests for the orchestration logic.
Severity
High — actively causes silent failures or blocks development
Affected Files
cmd/virtwork/main.go — runE function (~450 lines, 0% unit test coverage)
cmd/virtwork/main.go — cleanupE function (~140 lines, 0% unit test coverage)
Proposed Fix
Extract the orchestration logic into a testable internal package (e.g., internal/orchestrator) that takes interfaces for client, auditor, and logger. Break runE into smaller functions: planVMs(), createServices(), createSecrets(), createVMs(), waitForReadiness(). The cmd layer becomes a thin shell that parses flags and calls the orchestrator.
This also addresses the function length concern — the current monolithic runE violates Go best practices for function complexity.
Area: CLI / Configuration, Testing
Architecture Layer: Layer 4 - Orchestration (cmd, cleanup)
Category
Missing tests
Description
runEis ~450 lines handling config loading, audit init, workload planning, service creation, secret creation, VM creation, readiness waiting, and summary printing.cleanupEis ~140 lines with similar breadth. These are the riskiest functions in the codebase and the hardest to test.All internal packages have 84-96% coverage, but
cmd/virtworksits at 1.3%. The E2E tests provide some coverage but require a live cluster. There are no unit-level tests for the orchestration logic.Severity
High — actively causes silent failures or blocks development
Affected Files
cmd/virtwork/main.go—runEfunction (~450 lines, 0% unit test coverage)cmd/virtwork/main.go—cleanupEfunction (~140 lines, 0% unit test coverage)Proposed Fix
Extract the orchestration logic into a testable internal package (e.g.,
internal/orchestrator) that takes interfaces for client, auditor, and logger. BreakrunEinto smaller functions:planVMs(),createServices(),createSecrets(),createVMs(),waitForReadiness(). The cmd layer becomes a thin shell that parses flags and calls the orchestrator.This also addresses the function length concern — the current monolithic
runEviolates Go best practices for function complexity.Area: CLI / Configuration, Testing
Architecture Layer: Layer 4 - Orchestration (cmd, cleanup)