-
Notifications
You must be signed in to change notification settings - Fork 23
fixed port bindings for testcontainers #67
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
base: master
Are you sure you want to change the base?
Conversation
LaurentRDC
left a comment
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.
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 |
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.
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.
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.
mostly just to not have to deal with wrapping no op in the user level
| redisContainer <- | ||
| run $ | ||
| containerRequest redis | ||
| & setPortBindings [(16379, "6379/tcp")] |
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's interesting that you can specify a port and protocol. Can we add this to the example in the setPortBindings docstring?
| 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 |
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.
TODO: i want to be able to handle this at the user level instead
| -- | ||
| -- This will fail if port 5432 or 5433 is already bound on the host. | ||
| -- | ||
| -- @since 0.5.1.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.
TODO doc string is probably wrong
3264b0d to
53c6854
Compare
mostly for testing