Repository navigation
test(android): remove false boots and port races from emulator, session and reaper tests - #302
Merged
Merged
Conversation
The collision tests paired an emulator that exits with an adb fake that always reports a finished boot. A boot poll that ran before the exit was seen let startEmulator resolve, so the give-up test failed about once in 30 runs. The give-up test now uses an adb that never reports a boot. The retry test uses an adb that reports a boot only for the retry port. Closes #210
The port allocator's TCP probe briefly binds each port it checks, so two concurrent runs of session.test.ts or reaper.test.ts can see each other's fixed explicit ports as bound and fail with a port collision. Move the host-wide abstract socket lock from emulator.test.ts into a shared helper. Each file now holds its own named lock over its disjoint port window, so a second run of one file waits while different files still run in parallel. Closes #293
3 tasks done
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.
Two Android test races fixed in test code only.
#210: the port collision tests paired a fake emulator that exits with a collision with an adb fake that reports the device as booted. When the fake emulator exited slowly, a boot poll won and
startEmulatorresolved. "Gives up after the bounded retries" now uses the existing never-booting adb fake. "Retries on a fresh port" had the same race, so it now uses an adb fake that reports a boot only for the retried port's serial. Both tests still prove the same behavior.startEmulatoralready prefers an exit it has observed, so no product change was needed.#293: two processes probing the same port the way the allocator does see it as bound about 16% of the time. The abstract socket lock from
emulator.test.tsmoved intopackages/android/test/port-lock.ts. The session, reaper and emulator test files each take their own named lock over their own port range, so a second copy of the same file waits, and different files still run in parallel.Closes #210
Closes #293
~/Artifacts/pickforge-batch3-2026-10-08/worker-B-pf-raceemulator.test.ts30 of 30, twiceworker-B-pf-raceworker-B-pf-raceworker-B-pf-race~/Artifacts/pickforge-batch3-2026-10-08/210-293-android-test-races-cov.logQA device pass: skipped. The change is test code only, so there is nothing to drive.