Skip to content

fix: use dynamic port in server scenario tests to avoid conflicts#221

Open
max-stytch wants to merge 1 commit intomodelcontextprotocol:mainfrom
max-stytch:fix/dynamic-port-server-tests
Open

fix: use dynamic port in server scenario tests to avoid conflicts#221
max-stytch wants to merge 1 commit intomodelcontextprotocol:mainfrom
max-stytch:fix/dynamic-port-server-tests

Conversation

@max-stytch
Copy link
Copy Markdown

Motivation and Context

  • Server scenario tests were hardcoded to port 3001, which is a commonly used port. If anything is already running on it, the tests hang for 30s and then fail
  • Replace TEST_PORT = 3001 with a getFreePort() helper that lets the OS assign a free port via listen(0). This is the same mechanism that all other invocations of listen() in the codebase already use.
  • Tests pass consistently regardless of what else is running locally

How Has This Been Tested?

  • All 87 tests pass locally (verified via pre-push hook)
  • CI passes

Breaking Changes

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

Copy link
Copy Markdown
Contributor

@nbarbettini nbarbettini left a comment

Choose a reason for hiding this comment

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

LGTM

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