Repository navigation
test: isolate takeover, containment and emulator tests from concurrent suites - #289
Merged
Merged
Conversation
Workers wait on a barrier before claiming, and a winner holds the lease until every worker has attempted. Spawn skew can no longer turn the race into two sequential claims. The test asserts the loser's attempt ended before the winner released. Closes #278
The refused cleanup still empties the scope, so a concurrent creator's prune could remove it before the existence check. Closes #279
The console ports are host-global and the TCP probe binds each port it checks. An abstract Unix socket lock makes a second run of the file wait. Closes #280
This was referenced Oct 7, 2026
Closed
2 tasks done
The locked-AVD test wrote the holder pid into the lock as soon as the spawn event fired. Until exec sets up the new image, /proc reports an empty cmdline, so startEmulator read the lock as stale and started the fake emulator. The test now polls up to 5 s for "emulator" in the holder's cmdline before it writes the lock. If a start wrongly succeeds, the test stops that emulator before it fails. The port lock now waits only on EADDRINUSE. Other listen errors fail at once with their code instead of spinning for 120 s. Closes #294
…ease The race test still requires HumanLeaseHeldError for the loser. When the loser gets StaleHumanLeaseError instead, the worker now reports the raw lease content it read, and the assertion message shows it. This makes a failure from the partly written lease window in #298 diagnosable.
…t-suite-isolation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three tests failed when two full suites ran on one host. Each fix is in test code only.
#278: the takeover workers now wait at a barrier and claim together. The winner holds the lease until every worker has tried. Each worker reports claim and release times, and the test asserts the loser's claim ended before the winner released. Starting the old worker 400 ms late gave two winners with no overlap, so the old failure was a timing assumption. Changing
wxtowintakeover.tsmakes the new test fail with two winners.#279: after the refused cleanup, the victim and the supervisor exit and the scope cgroup is empty. A concurrent
createContainmentScopethen prunes it. The test now builds its scope in a private parent cgroup, as the probe and re-creation tests do. With a concurrent scope creator, the old test failed 10 of 10 runs at the reported line.#280: the AVD home and port registry were already private to each run. The collisions came from host-wide TCP ports. The emulator test file now takes an abstract Unix socket lock in
beforeAll, so a second run waits. The kernel frees the lock when its owner exits. The tests still use the real ports and exercise the real collision paths.The third #280 failure, "refuses a writable start while a live emulator holds the AVD lock", came from the test, not from the port collisions. The test wrote the holder pid into the AVD lock right after the spawn event. Until the new image sets up its arguments, the kernel reports an empty
cmdline, so the product read the lock as stale. The test now waits until the holder'scmdlineshowsemulator, and stops any emulator that starts by mistake. An experiment saw emptycmdlinereads right after spawn in 3 of 3000 Node spawns under heavy load. The port lock now retries only onEADDRINUSE. The takeover worker also reports the raw lease when a loser sees a stale lease, which links such a failure to #298. If a test fails midway, the containment test now removes its private cgroups and reports any it cannot remove.Closes #278
Closes #279
Closes #280
Closes #294
/tmp/pfloadwxchanged towintakeover.ts/tmp/pfloadcgroup.procsand victim state recorded at the check; concurrent creator running/tmp/pf279/tmp/pf279emulator.test.ts/tmp/pf280cmdlinereads after spawn: Node 3 of 3000 under 48 busy loops;emulator.test.ts10 runs under 16 busy loops~/Artifacts/pickforge-batch2-2026-10-07/worker-cmdline-exp~/Artifacts/pickforge-batch2-2026-10-07/289-cov-final.logQA device pass: skipped. The change is test code only, so there is nothing to drive.