Skip to content

test(api): use random ports for getFreePort e2e tests - #179

Merged
chenjiahan merged 2 commits into
mainfrom
codex/fix-randomize-getfreeport-tests
Apr 1, 2026
Merged

chenjiahan merged 2 commits into
mainfrom
codex/fix-randomize-getfreeport-tests

Conversation

@chenjiahan

Copy link
Copy Markdown
Member

Summary

This PR updates the Server.getFreePort e2e coverage to use random ports instead of a fixed 60000 range. It adds a small test helper for reserving random ports and keeps the assertions on retry behavior while removing a CI hotspot that could collide with other processes.

Verified with targeted rstest runs for the Server.getFreePort cases.

Related Links

None

@chenjiahan
chenjiahan marked this pull request as ready for review April 1, 2026 03:51
Copilot AI review requested due to automatic review settings April 1, 2026 03:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Server.getFreePort e2e tests to avoid a fixed port range by introducing a random-port helper and switching the assertions to use per-run reserved ports, reducing CI flakiness due to port collisions.

Changes:

  • Added tests/helpers/get-random-port.js to pick random (and sequential) ports for tests.
  • Updated tests/e2e/api.test.js Server.getFreePort coverage to use randomly selected base/busy ports instead of the fixed 60000+ range.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
tests/helpers/get-random-port.js New helper to find “random” available ports and contiguous port blocks for tests.
tests/e2e/api.test.js Switches Server.getFreePort e2e cases to use reserved random ports and updates expectations accordingly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/helpers/get-random-port.js Outdated
Comment thread tests/helpers/get-random-port.js Outdated
Comment thread tests/helpers/get-random-port.js Outdated
Comment thread tests/e2e/api.test.js

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4de6d50eb1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/helpers/get-random-port.js
@chenjiahan
chenjiahan merged commit 4b71590 into main Apr 1, 2026
3 checks passed
@chenjiahan
chenjiahan deleted the codex/fix-randomize-getfreeport-tests branch April 1, 2026 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants