How to verify a pact?

57 views Asked by At

I have a pact published on a pact broker, and I need now to verify it with the provider. I started by using the pact-cli on a docker image, and using pact-provider-verifier I can connect to the provider box but verification fails because the broker request does not carry a Bearer token. I could not find a way to include token to the request using pact-provider-verifier, so I went to using Rake. I installed Rake and gem, run rake pact:verify — and I saw the possibility to pass a token towards the provider — but test fails because in the config I should — it seems — define my ‘app’ but I have no idea why app I should define. Questions I have are:

  • is there a way to pass bearer token towards the provider using pact-provider-verifier?
  • if not, how do I exactly configure Rake to hit my provider?
  • Is there any other way of verifying a pact using a broker?

Thank you in advance!

1

There are 1 answers

4
Matthew Fellows On

It sounds like you're testing a Java app, is there a reason you're not using Pact JVM and using the CLI (or Ruby) instead?

There is an example JVM provider you can use as an example here.

With respect to authentication, there is a guide on strategies you can take to handle such things. If you're using the CLI you have two options

  1. Stub the CLI layer in your provider
  2. Use the --header option to add a valid bearer token