Repository navigation
test(android): isolate emulator port tests from live emulators - #163
Merged
Merged
Conversation
The console port reservation and port collision test groups assumed console ports 5554 to 5562 were free, so they failed on any machine running a real Android emulator. Add an optional portRange seam to startEmulator and the internal allocator, defaulting to the existing AUTO_MIN_CONSOLE_PORT and MAX_CONSOLE_PORT, and derive every port in those groups from a private base of 5670. Production defaults, CLI flags and environment reads are unchanged. Closes #160
The android session and reaper tests passed explicit console ports 5554, 5556, 5558 and 5560 to createAndroidSession and startEmulator, so the pre-flight free-port probe rejected them whenever a real emulator held that window. Derive their explicit ports from a test-private base per file, 5640 for the session tests and 5648 for the reaper test, and report the matching serial from each fake adb. The whole packages/android suite now passes with listeners bound on 5554 to 5563. Refs #160
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.
The android tests assumed console ports 5554 to 5562 were free, so
packages/android/test/emulator.test.ts,session.test.tsandreaper.test.tsfailed whenever a real emulator ran on the machine.startEmulatorgains an optionalportRangeseam (autoMin,max) forwarded to automatic allocation; production callers omit it and keep 5554 and 5556 to 5682, with no new flag or environment read. The emulator tests derive every port from a private base at 5670, the session tests from 5640 and the reaper test from 5648, so each assertion keeps its meaning (skip on bound port lands on base+2, explicit reserved or bound port is refused, emulator-reported collision retries on the next port, bounded retries give up). The explicit 5554 case became "accepts an explicit port below the auto-allocation floor".Validation:
bunx vitest run packages/android(10 files, 154 tests) with ports free and again with loopback listeners bound on 5554 to 5563;bun run lint,bunx tsc --noEmit,bunx complexity-gate check --changed.Closes #160