Diferdin
Diferdin

Reputation: 1260

How to verify a pact?

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:

Thank you in advance!

Upvotes: 0

Views: 271

Answers (1)

Matthew Fellows
Matthew Fellows

Reputation: 4065

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

Upvotes: 0

Related Questions