Skip to content

fix: honor the configured Keploy port - #130

Open
Pranav-Bobde wants to merge 1 commit into
keploy:mainfrom
Pranav-Bobde:fix/configured-keploy-port
Open

Pranav-Bobde wants to merge 1 commit into
keploy:mainfrom
Pranav-Bobde:fix/configured-keploy-port

Conversation

@Pranav-Bobde

Copy link
Copy Markdown

Problem

The README documents RunOptions.port as the port Keploy runs on, but the legacy Test runner in keployCli.ts ignored it. It always started keploybin test with --port 6789 and sent every GraphQL request to port 6789, even when the caller set another port.

Change

Resolve the port once per run: an unset port or 0 keeps the default, 6789, as before. An explicit port must be an integer from 1 to 65535, since it goes into the shell command, and anything else fails before Keploy starts. The resolved port is passed to the CLI and to every GraphQL request, including shutdown.

Checked

  • New tests in test/legacy-cli.test.mjs stub the process launch and GraphQL calls, and check the command and request URLs without starting Keploy.
  • With port: 7211, the run used --port 6789 before this change and uses 7211 after it.
  • An unset port and 0 both still use 6789.
  • -1, 65536, 1.5, NaN, '', false, null and a string with shell characters are rejected before launch.
  • bun run build passes, and node --test test/*.test.mjs passes all 54 tests.

Signed-off-by: Pranav-Bobde <bobdep31@gmail.com>
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.

1 participant