fix(test): target the actual bound port when a dev/prod server rebinds#716
Merged
Conversation
vxrn/vite rebind to a different port when the requested one is taken (a check-then-bind race when test packages start concurrently under turbo). The readiness check and ONE_SERVER_URL kept targeting the requested-but- vacated port, so setup timed out — e.g. test-loaders flaking with 'Server at http://localhost:53414 did not start ... 242721ms'. Parse the actual bound port from the server's output (resolveBoundServerUrl) and use it for the readiness poll and the returned testDevPort/testProdPort. Conservative: only deviates when the server reports the requested port was in use, so the common (no-move) path is unchanged.
|
🚅 Deployed to the one-pr-716 environment in onestack.dev
|
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.
Problem
Intermittent
tests-job flake (seen on PR #715's first run):tests/test-loaderssetup timed out —vxrn/vite rebind to a different port when the requested one is taken — a check-then-bind race when many test packages start concurrently under turbo (the existing random-port-base +
killProcessOnPortmitigations reduce but don't eliminate it). When it happens, both the readiness check andONE_SERVER_URL(built fromtestDevPort/testProdPortinsetup.ts) keep pointing at the requested-but-vacated port → 242s timeout. Native iOS tests are unaffected (fixed ports).Fix
resolveBoundServerUrl(requestedUrl, output)parses the actual bound port from the server's stdout andwaitForServerpolls/returns it; the caller uses it fortestDevPort/testProdPort. Conservative: only deviates when the server reportsPort <n> is in use, so the common no-move path is byte-for-byte unchanged.Verification (local)
resolveBoundServerUrlexercised across happy / trailing-slash / moved-port / move-without-new-url cases → all correct.test-loaderstest:dev → 35 passed, 8 skipped, readiness check fired normally (Server at http://localhost:51982 is ready after 7854ms).@vxrn/test) exit 0 · oxlint 0/0.@vxrn/testexports fromsrc, so no build step; the PR's owntestsjob re-runs the full web suite as the safety gate.)