This repository was archived by the owner on Jun 7, 2026. It is now read-only.
fix(gateway): resolve flaky tests from port conflicts and shared state - #75
Merged
Conversation
Fixes #72 The integration tests in app.test.ts were using the default port 3100, which conflicts with sdk.integration.test.ts when running in parallel. Changes: - Set PORT=0 in vi.hoisted block to get an OS-assigned port - Add afterAll hook to properly close the server after tests - Import server export for cleanup
Fixes #70 The concurrency module has shared state that was causing "socket hang up" errors when concurrency.test.ts ran in parallel with integration tests. Changes: - Use poolMatchGlobs to run integration and concurrency tests in forks pool - Other tests continue to run in parallel threads pool for speed - Forks pool provides process isolation, preventing shared state conflicts
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
app.test.tsby using OS-assigned port (Flaky test: EADDRINUSE port conflict in integration tests #72)concurrency.test.tsby isolating tests with shared state (Flaky test: concurrency.test.ts 'socket hang up' when run in parallel #70)Changes
Issue #72 - EADDRINUSE
PORT=0inapp.test.tsto get an OS-assigned port (matchingsdk.integration.test.ts)afterAllhook to properly close the server after testsIssue #70 - Socket hang up
poolMatchGlobsfor targeted test isolationforkspool (isolated processes)threadspool for speedTest plan
bun run testmultiple times - all 143 tests pass consistentlyFixes #70
Fixes #72