-
-
Notifications
You must be signed in to change notification settings - Fork 109
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
Add flag --mock-port / -m to specify port for Mock #47
Conversation
When running pact-go in containers we want to expose minimal number of ports. Currently it randomly selects _any_ port. This makes it impossible to expose ports in a container. This change will add a CLI option to specify a port to deploy the mocking service on. This way we know exactly which port to expose.
In my defense of not handling if they pass a used port: the |
To resolve #46 |
Thanks @zbintliff, and sorry I wasn't able to provide guidance on how to achieve this last week. I think this is better controlled by the consumer DSL (via API), not via the daemon itself. The daemon is multi-threaded, and so it is able to spin up and manage multiple mock servers in its lifetime. Having this specified on the command-line will limit it to just a single mock server at any point in time. I'd look to add a new field to |
Ok thanks for the direction. Just for my own understanding (still new to pact). When does the daemon spin up a new mock server? For every client or ever interaction? |
@mefellows just trying to get a better understanding before I adjust the PR. Can you comment on the above question? |
The mock service is started once per client, as in it will stay up for all the interactions. It will shutdown the mock service (and write the pact for the consumer/provider pair) when |
Sorry for delay. I still want to specify a range of ports. We will have a few mock clients with different ports and I think putting that logic in the daemon makes more sense. ENV variable PORTS_RANGE with this change we can also add some retry logic on getting the port, because we have already ran into cases where it has grabbed a used port Edit: Nevermind, starting to grok what you said |
Since i started from scratch agian I opened a new pr: #49 |
When running pact-go in containers we want to expose minimal number of
ports. Currently it randomly selects any port. This makes it
impossible to expose ports in a container.
This change will add a CLI option to specify a port to deploy the
mocking service on. This way we know exactly which port to expose.