3

I'm trying to perform provider verification using scala-pact implementation. My dockerized service under test is located at http://localhost:9999/my_test_label/my_service. There is

def runVerificationAgainst[F[_]](protocol: String, host: String, port: Int, clientTimeout: Duration)

function provided by scala-test bu I'm unable to provide such url as mine. The problem is my_test_label needed by other tests (or anything between port number and service url). The only thing I can do is to invoke the verifier as follow: runVerificationAgainst("http", "localhost", 9999, 10.seconds) which ends with verifying the http://localhost:9999/my_service (my_service is provided from the pact.json file).

The only workarounds I found is to remove the my_test_label from the dockerized service (which is hard because of dependencies) or to capture and modify the pact.json file before the verification (which is not a good practise). Is it possible to provide such url into the scala-pact verifier or I need to use pact CLI to achieve the goal?

Klikam
  • 31
  • 1

1 Answers1

0

This question is more about the application design.

  • The contract must always be declared with full path, i.e. anything after the port. If it doesn't, you bring confusion against the expectations from the URL at any environment this app will be located.
  • The server application should always be customizable for the base path, i.e. declare in properties. If so, you're capable implement any test against any base path.

Particular advice here: adjust the pact on the consumer side to the side of the target path, I assume it is /my_test_label/my_service

Artem Ptushkin
  • 1,151
  • 9
  • 17