Bug Description
E2E tests have 6 defects across 3 files that cause 5 test failures (one defect is already fixed locally but not yet merged). The root causes are:
-
internal/testutil/binary.go hardcoded CGO_ENABLED=0 — The test harness binary builder set CGO_ENABLED=0 for "portability," but go-sqlite3 (a CGO dependency) requires CGO_ENABLED=1. This caused every E2E test to fail because the compiled binary couldn't initialize the audit subsystem. Already fixed locally (line 75 changed from CGO_ENABLED=0 to CGO_ENABLED=1), needs to be committed.
-
dryrun_test.go:79 — wrong error substring — The test asserts Expect(stderr).To(ContainSubstring("unknown workload")), but the registry error (internal/workloads/registry.go:101) actually says workload "nonexistent" not found. The substring "unknown workload" never appears in the output.
-
cleanup_test.go:44,82 and fullcycle_test.go:55,93 — output format mismatch after slog migration — Four assertions expect human-readable strings like "1 VMs deleted" or "0 VMs deleted" in stdout. After the migration from fmt.Fprintf to structured slog logging, the actual output is JSON: {"level":"INFO","msg":"cleanup complete","vms_deleted":1,...}. The substring "N VMs deleted" no longer appears.
Steps to Reproduce
# From repo root, with a connected cluster:
CGO_ENABLED=1 go test -count=1 -tags e2e -timeout 600s ./tests/e2e/...
Expected Behavior
All E2E tests pass (18/18).
Actual Behavior
5 tests fail:
| Test |
File:Line |
Assertion |
Actual Output |
| should fail for unknown workload name |
dryrun_test.go:79 |
ContainSubstring("unknown workload") |
workload "nonexistent" not found; available: ... |
| should delete all managed resources |
cleanup_test.go:44 |
ContainSubstring("1 VMs deleted") |
{"msg":"cleanup complete","vms_deleted":1,...} |
| should be idempotent |
cleanup_test.go:82 |
ContainSubstring("0 VMs deleted") |
{"msg":"cleanup complete","vms_deleted":0,...} |
| should deploy CPU workload... |
fullcycle_test.go:55 |
ContainSubstring("1 VMs deleted") |
{"msg":"cleanup complete","vms_deleted":1,...} |
| should deploy network workload... |
fullcycle_test.go:93 |
ContainSubstring("2 VMs deleted") |
{"msg":"cleanup complete","vms_deleted":2,...} |
Proposed Fix
-
internal/testutil/binary.go:75 — Change CGO_ENABLED=0 → CGO_ENABLED=1.
-
dryrun_test.go:79 — Change assertion to match actual registry error:
Expect(stderr).To(ContainSubstring("workload not found"))
-
cleanup_test.go and fullcycle_test.go — Update 4 assertions to match structured slog JSON output. Either:
- Assert on the JSON key:
ContainSubstring("vms_deleted") plus a count check, or
- Assert on the slog message:
ContainSubstring("cleanup complete")
Additional Context
- The slog migration (from
fmt.Fprintf to internal/logging.NewLogger()) was applied to cmd/virtwork/main.go but the E2E test expectations were not updated to match.
- The stale comment on
binary.go:30 still says "built with CGO_ENABLED=0 for portability" — should be updated to reflect CGO_ENABLED=1 and the go-sqlite3 requirement.
- 13 of 18 E2E tests pass after the CGO fix alone; only these 5 string-mismatch failures remain.
Bug Description
E2E tests have 6 defects across 3 files that cause 5 test failures (one defect is already fixed locally but not yet merged). The root causes are:
internal/testutil/binary.gohardcodedCGO_ENABLED=0— The test harness binary builder setCGO_ENABLED=0for "portability," butgo-sqlite3(a CGO dependency) requiresCGO_ENABLED=1. This caused every E2E test to fail because the compiled binary couldn't initialize the audit subsystem. Already fixed locally (line 75 changed fromCGO_ENABLED=0toCGO_ENABLED=1), needs to be committed.dryrun_test.go:79— wrong error substring — The test assertsExpect(stderr).To(ContainSubstring("unknown workload")), but the registry error (internal/workloads/registry.go:101) actually saysworkload "nonexistent" not found. The substring"unknown workload"never appears in the output.cleanup_test.go:44,82andfullcycle_test.go:55,93— output format mismatch after slog migration — Four assertions expect human-readable strings like"1 VMs deleted"or"0 VMs deleted"in stdout. After the migration fromfmt.Fprintfto structuredsloglogging, the actual output is JSON:{"level":"INFO","msg":"cleanup complete","vms_deleted":1,...}. The substring"N VMs deleted"no longer appears.Steps to Reproduce
Expected Behavior
All E2E tests pass (18/18).
Actual Behavior
5 tests fail:
dryrun_test.go:79ContainSubstring("unknown workload")workload "nonexistent" not found; available: ...cleanup_test.go:44ContainSubstring("1 VMs deleted"){"msg":"cleanup complete","vms_deleted":1,...}cleanup_test.go:82ContainSubstring("0 VMs deleted"){"msg":"cleanup complete","vms_deleted":0,...}fullcycle_test.go:55ContainSubstring("1 VMs deleted"){"msg":"cleanup complete","vms_deleted":1,...}fullcycle_test.go:93ContainSubstring("2 VMs deleted"){"msg":"cleanup complete","vms_deleted":2,...}Proposed Fix
internal/testutil/binary.go:75— ChangeCGO_ENABLED=0→CGO_ENABLED=1.dryrun_test.go:79— Change assertion to match actual registry error:cleanup_test.goandfullcycle_test.go— Update 4 assertions to match structured slog JSON output. Either:ContainSubstring("vms_deleted")plus a count check, orContainSubstring("cleanup complete")Additional Context
fmt.Fprintftointernal/logging.NewLogger()) was applied tocmd/virtwork/main.gobut the E2E test expectations were not updated to match.binary.go:30still says "built with CGO_ENABLED=0 for portability" — should be updated to reflectCGO_ENABLED=1and thego-sqlite3requirement.