Skip to content

Reduce test wall-clock time without weakening coverage#309

Open
IlyaasK wants to merge 3 commits into
mainfrom
ilyaas/reduce-test-wallclock
Open

Reduce test wall-clock time without weakening coverage#309
IlyaasK wants to merge 3 commits into
mainfrom
ilyaas/reduce-test-wallclock

Conversation

@IlyaasK

@IlyaasK IlyaasK commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

What

Reduce the Hypeman test suite wall-clock time by removing measured lifecycle overhead:

  • cancel the full native compression process group when its context expires
  • use immediate VM shutdown only in test teardown while retaining the normal cleanup path
  • prepare VM-ready test images once per run instead of repeatedly unpacking layers
  • use 512 MiB guests for lifecycle tests that do not exercise memory capacity

Why

Wall-clock profiling showed that the suite was spending substantial time in repeated image preparation, graceful shutdown timeouts, oversized lifecycle guests, and a cancellation path that killed the shell but left its child process holding output pipes open.

These changes address those root causes directly. They do not shard the suite or add a test matrix.

Result

Linux Run tests step:

  • before: 259 seconds
  • after: 190 seconds
  • reduction: 69 seconds, or 26.6 percent

The full Linux job, macOS job, and install checks passed.

Test strength

No tests, assertions, VMM backends, or integration scenarios are removed.

Production DeleteInstance behavior remains unchanged. Immediate shutdown is restricted to test cleanup and terminal test teardown. Dedicated memory and resource-capacity tests retain their larger guest sizes.

The compression cancellation regression test also asserts that cancellation returns within one second, so the original 30-second child-process leak cannot silently return.

Verification


Note

Low Risk
Production delete and compression paths change only in ways that fix cancellation leaks; faster teardown and smaller test VMs are confined to tests and CI prewarm.

Overview
This PR targets measured overhead in the integration test suite (~27% faster Linux CI runs) without dropping scenarios or assertions.

CI prewarm now builds each mirrored image to ready disk state in cmd/test-prewarm (not just registry mirror), and Linux workflow chowns the prewarm dir so the runner can write there. snapshottest.EnsureImageReady reads HYPEMAN_TEST_PREWARM_DIR, so tests seed from that cache instead of repeatedly pulling/converting nginx and friends.

Test teardown adds deleteInstanceWithOptions with skipGracefulShutdown and a test-only deleteTestInstanceNow helper; integration cleanups use it so they skip the delete grace period while production DeleteInstance is unchanged.

Lifecycle guests that do not need large RAM use lifecycleTestMemorySize (512 MiB) instead of 1 GiB, shrinking snapshot/standby work. Dedicated memory-capacity tests keep their larger sizes.

Snapshot compression native helpers run in a process group and are SIGKILL’d on context cancel, with a regression test that cancellation returns within one second (avoids orphaned zstd children blocking Wait).

Reviewed by Cursor Bugbot for commit b4d95a4. Bugbot is set up for automated code reviews on this repo. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant