https://pact.io logo
#pact-jvm
Title
# pact-jvm
j

Jayakannan Jeyapandian

05/27/2022, 8:01 AM
Hello, have anyone tried passing the port number for the mock server as a command line argument when running consumer tests? Tried it but failing, may be I am missing something. Any thoughts? Thanks.
Copy code
@PactTestFor(providerName = "test-provider", port = "${pact.server.port}")
We would be setting the same port in one of our config yml file hence we would like to either set it via command line or read and pass it to our yml config similar to using @AutoConfigureWiremockPort which exposes the port via ${wiremock.server.port}
m

Matt (pactflow.io / pact-js / pact-go)

06/01/2022, 10:37 AM
It doesn’t appear that you can inject those properties there. Can you not use the standard approach here: https://docs.pact.io/implementation_guides/jvm/consumer/junit5#injecting-the-mock-server-into-the-test
j

Jayakannan Jeyapandian

06/01/2022, 10:38 AM
Thanks, unfortunately this won't work for as we load the properties file well before this where we use the pact mock server URL too.
m

Matt (pactflow.io / pact-js / pact-go)

06/01/2022, 10:39 AM
can you override the API client URL at runtime?
j

Jayakannan Jeyapandian

06/01/2022, 10:41 AM
Good question, need to check this.
đź‘Ť 1
m

Matt (pactflow.io / pact-js / pact-go)

06/01/2022, 10:45 AM
That’s how most people do it. This allows you to run multiple consumer tests in parallel. If you share the same point, you have to run them in serial
It also is configless then