Skip to content

test: replace sleeps in Rust tests with deterministic waits - #3146

Draft
liangmiQwQ wants to merge 3 commits into
voidzero-dev:mainfrom
liangmiQwQ:test/rust-test-sleeps
Draft

liangmiQwQ wants to merge 3 commits into
voidzero-dev:mainfrom
liangmiQwQ:test/rust-test-sleeps

Conversation

@liangmiQwQ

Copy link
Copy Markdown
Collaborator

Some Rust tests rely on sleeps to order events, which makes them depend on runner speed and filesystem timestamps.

  • vp_setup cleanup: the tests slept between create_dir calls so that creation times differ, but the order is arbitrary on filesystems with coarse or missing birth times. This PR moves the selection out of cleanup_old_versions into a private versions_to_remove, so the tests pass explicit times and assert the exact removed versions. A filesystem test still covers the directory scan with an order-independent result.
  • Upgrade check: instead of sleeping 200ms, the concurrency test waits until every check except the one holding the unanswered registry request has returned, then asserts that one request is still in flight.
  • implode (Windows): the child processes block on stdin until the test closes it, instead of sleeping 2 seconds while the parent polls for up to 5 seconds.

No behavior changes.

🤖 Generated with Claude Code

Split version selection out of cleanup_old_versions so tests pass explicit creation times instead of sleeping between create_dir calls, which left the order arbitrary on filesystems with coarse or missing birth times. One filesystem test still covers the directory scan with an order-independent outcome.
Wait until every check except the one holding the registry request has returned, then assert that request is still in flight, instead of sleeping 200ms and sampling the request count.
The child processes slept for 2s while the parent polled for up to 5s and then asserted they were still running. They now block on stdin until the test closes it.

This branch has not been deployed

No deployments
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