-
Notifications
You must be signed in to change notification settings - Fork 315
Allow OS to assign port automatically #750
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow OS to assign port automatically #750
Conversation
|
|
||
| await server.start() | ||
| const assignedPort = (server as any).port | ||
| expect(assignedPort).toBeGreaterThan(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should be ensured > 1024, pglite is not meant to run on privileged ports.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you just asking me to add an additional assert, or something else? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does node socket has warranty to a give a socket > 1024 ? if yes then just use .toBeGreaterThan(1024)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the OS will only not give out privileged any ports. Updated my test to check that port is greater than 1024.
|
@2xic Looks good, thank you! Just one more thing: please mention this new feature in the project's |
579171e to
0d42b0b
Compare
Port 0 is used by OS to random a random ephemeral port which can be a very useful feature for CI and when you just need to spin up a server quickly.
The current implementation prevents this from being possible as
0is falsy so we fallback to the default port. This change changes that by checking the type passed in the config to allow passing port number 0.