Allow OS to assign port automatically - #750
Merged
tdrz merged 4 commits intoAug 12, 2025
Merged
Conversation
2xic
marked this pull request as ready for review
July 30, 2025 13:01
pmp-p
reviewed
Aug 4, 2025
|
|
||
| await server.start() | ||
| const assignedPort = (server as any).port | ||
| expect(assignedPort).toBeGreaterThan(0) |
Contributor
There was a problem hiding this comment.
it should be ensured > 1024, pglite is not meant to run on privileged ports.
Contributor
Author
There was a problem hiding this comment.
Are you just asking me to add an additional assert, or something else? 🤔
Contributor
There was a problem hiding this comment.
does node socket has warranty to a give a socket > 1024 ? if yes then just use .toBeGreaterThan(1024)
Contributor
Author
There was a problem hiding this comment.
Yeah, the OS will only not give out privileged any ports. Updated my test to check that port is greater than 1024.
Contributor
pmp-p
approved these changes
Aug 9, 2025
Collaborator
|
@2xic Looks good, thank you! Just one more thing: please mention this new feature in the project's |
2xic
force-pushed
the
feature/allow-os-assigned-port
branch
from
August 11, 2025 17:07
579171e to
0d42b0b
Compare
Contributor
Author
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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.