Repository navigation
fix(mock): avoid cluster HTTP port collisions in parallel tests - #6069
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (4)
💤 Files with no reviewable changes (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughCluster startup now detects a free port when no port is configured. The cluster records the actual port reported by the child process. The updated tests cover default and explicit ports, port ChangesMock cluster port selection
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~12 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to Default-port selection and reporting show no established merge-blocking regression. The explicit-zero edge case remains outside this change. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying egg with
|
| Latest commit: |
ec36b5c
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://155bbc8c.egg-cci.pages.dev |
| Branch Preview URL: | https://fix-mock-cluster-port-alloca.egg-cci.pages.dev |
Deploying egg-v3 with
|
| Latest commit: |
ec36b5c
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://267adf43.egg-v3.pages.dev |
| Branch Preview URL: | https://fix-mock-cluster-port-alloca.egg-v3.pages.dev |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6069 +/- ##
==========================================
+ Coverage 80.39% 83.61% +3.21%
==========================================
Files 18 731 +713
Lines 852 22608 +21756
Branches 228 4554 +4326
==========================================
+ Hits 685 18903 +18218
- Misses 139 3202 +3063
- Partials 28 503 +475 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
detectPort()in the child before startup, instead of a PID-based global counter. Vitest threads share a PID but have independent globals, so concurrent clusters can receive the same counter value.app.portfromegg-readybefore resolving readiness, keepingaddress(), HTTP requests and synchronous mock RPC on the actual port. Explicit ports, including0as the application's configured port, keep their existing semantics.Motivation
The Windows Node 22 main failure shows
EADDRINUSE :17773and a cluster startup exit, followed bycustomDirectoryfinding no schedule logs on all retries. The log does not directly map that process to the fixture, so the historical attribution remains an inference. The new negative regression deterministically reproduces the port collision and readiness continuing after startup failure on unchanged main, then passes with this fix.The schedule test and its timing are unchanged. This uses the existing free-port detection convention; it does not claim to eliminate the general probe/release/bind race. A default
app.portis now0untilawait app.ready()completes.Validation
Linux, Node 24.19.0, no build before tests, retries disabled:
EADDRINUSEand the expected port assertionoxlint --type-aware --type-check,oxfmt --check, andgit diff --check: passedLocal environment limits: utoo registry connections timed out, so dependencies were installed with a temporary pnpm workspace derived from the tracked catalogs. The container blocks
os.networkInterfaces(), so runtime tests used a local loopback-only interface shim. Neither workaround is committed; local results are not a substitute for Windows CI. Theci:fullmatrix has now validated the final head on all supported combinations (see below).Final CI verification
Head
ec36b5c7c884a64aee4a95ba48fa7e0062d1f605, tested as merge commit5eab766e0bd27d97e2865e50b206deebd64fdd09with maina9deafba1fc2bf6b937811238f9675411d66ed38:customDirectorytest passed without retry markersSummary by CodeRabbit
0, are respected, and clusters report the port they actually use.