Hello, Is there a way to test a consumer contract ...
# general
a
Hello, Is there a way to test a consumer contract (as bi-directional contract) with a provider without publishing it to the broker ?
j
Yeah! The pact verifier cli has an option to pass it a contract file to verify
Which pact verifier cli are you using? (I am pretty sure they both have this option, the ruby one and the rust one)
a
nodejs
but it seems the pact verifier cli is written with ruby
j
This is the one I'm using and it has a
-f
option for passing a pact file:
a
thanks πŸ™‚
j
Hmm, actually, I'm not sure if the ruby implementation of the pact verifier cli has this option. I'm not seeing it here: https://github.com/pact-foundation/pact-provider-verifier#usage So looks like you'll want to try out the rust implementation (the first one I linked)
a
--file
and
--dir
options are ignored when the env variable
PACT_BROKER_BASE_URL
is defined πŸ˜•
also this tool verify pact files against a running provider. is it possible to verify it with the provider pact submitted on the pact broker instead ?
j
yes, you don't need the pact broker if you're passing the contract file
a
yes, but it requires a running provider, is there a way to verify a consumer contract using the provider contract instead of a running provider ?
j
I think you're a little confused, the contract is written by the consumer and verified against a running instance of the provider. I'm not sure exactly what you mean by "provider contract" but the provider doesn't produce a contract
a
on my ci flow the provider publish an OAS on the pact broker. I wanna know this is possible to verify if a consumer contract is compatible with my provider oas
(i'm trying to use bi-directional contracts)
j
I've never heard of bi-directional contracts in pact. I thought it only supported consumer-driven contracts
m
Is there a way to test a consumer contract (as bi-directional contract) with a provider without publishing it to the broker ?
Are you asking if there is a way to confirm locally if a change on the provider/consumer will break things, rather than finding out using
can-i-deploy
later in the pipeline? If so, not yet, but it’s on the roadmap (see can-i-deploy local)
@json this is a Pactflow specific feature, and not something part of Pact OSS
πŸ‘ 1
a
I'm asking if I could run
can-i-deploy
command with a local contract instead of publishing it to the pact broker. My ci/cd workflow is basically
pact-broker publish
pact-broker can-i-deploy
pact-broker record-deployment
and I would want to just run
can-i-deploy
locally (with uncommited local changes for example) to make sure my code is fine and only publish validated contracts
m
Yep that's exactly the feature we're building. Not ready yet but on the near term horizon as per that roadmap
πŸ‘ 1
a
ok thanks πŸ™‚