fixed port bindings for testcontainers#67
Draft
justinwoo wants to merge 1 commit intotestcontainers:masterfrom
Draft
fixed port bindings for testcontainers#67justinwoo wants to merge 1 commit intotestcontainers:masterfrom
justinwoo wants to merge 1 commit intotestcontainers:masterfrom
Conversation
LaurentRDC
reviewed
Nov 18, 2025
Collaborator
LaurentRDC
left a comment
There was a problem hiding this comment.
Thanks for your contribution!
| -- This will fail if port 5432 or 5433 is already bound on the host. | ||
| -- | ||
| -- @since 0.5.1.0 | ||
| setPortBindings :: [(Int, Port)] -> ContainerRequest -> ContainerRequest |
Collaborator
There was a problem hiding this comment.
Is there any reason to have NO port bindings, i.e. the empty list? Otherwise, I'd like to see a NonEmpty (Int, Port) instead.
Contributor
Author
There was a problem hiding this comment.
mostly just to not have to deal with wrapping no op in the user level
| redisContainer <- | ||
| run $ | ||
| containerRequest redis | ||
| & setPortBindings [(16379, "6379/tcp")] |
Collaborator
There was a problem hiding this comment.
It's interesting that you can specify a port and protocol. Can we add this to the example in the setPortBindings docstring?
justinwoo
commented
Nov 18, 2025
| in throw $ | ||
| containerPort Container {id, inspectOutput, containerPortBindings} requestedPort@(Port {port, protocol}) = | ||
| -- First check if there's a fixed binding for this port | ||
| case find (\(_, boundPort) -> boundPort == requestedPort) containerPortBindings of |
Contributor
Author
There was a problem hiding this comment.
TODO: i want to be able to handle this at the user level instead
justinwoo
commented
Nov 18, 2025
| -- | ||
| -- This will fail if port 5432 or 5433 is already bound on the host. | ||
| -- | ||
| -- @since 0.5.1.0 |
Contributor
Author
There was a problem hiding this comment.
TODO doc string is probably wrong
3264b0d to
53c6854
Compare
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.
mostly for testing