question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Message Provider Validation against Pact Broker Wrongly Succeeds

See original GitHub issue

I have a strange behavior during message provider verification.

I successfully published a message pact to my test pact broker instance (v 2.26.0, hosted by you, if it helps 😉). When viewing the message pact in the pact broker, it says Note: this contract could not be parsed to a v1 or v2 Pact, showing raw content instead. and only shows the JSON.

When I run my provider test, it succeeds, even though my message provider returns an invalid message.

When I run the provider test against a local pact file instead, it fails, as I would expect.

Maybe the verifier doesn’t find the pact on the broker (because the broker does not support message contracts) and since it hasn’t found a pact, it just succeeds? If this is the case:

  • I would expect the verifier to fail if it doesn’t find any pacts to test against.
  • when will the pact broker support message contracts? 😉

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
mefellowscommented, Nov 25, 2018

OK, so if you turn on debugging you might get more of an indication as to what is happening. It looks like “latest” is not a tag (also you shouldn’t tag anything "latest", I think it’s documented somewhere…, but mainly because latest is a special case in the broker, see below).

Although it’s not a tag, it’s tricking Pact Node by not returning a 40x type error when it goes to find relevant pacts. But when it invokes the verification process, it doesn’t yet have a Pact and fires off the command omitting some key properties - e.g.

[2018-11-25T06:45:57.311Z]  INFO: pact-node@6.19.11/62781 on macfellows.local: Created './standalone/darwin-1.54.4/bin/pact-provider-verifier --broker-username 'dXfltyFMgNOFZAxr8io9wJ37iUpY42M' --broker-password 'O5AIZWxelWbLvqMd8PkAVycBJh2Psyg1' --publish-verification-results 'true' --provider-app-version '1.0.0' --provider-base-url 'http://localhost:54819'' process with PID: 62787

With the correct tags, you’ll see it adds a bunch more:

[2018-11-25T06:49:57.613Z]  INFO: pact-node@6.19.11/63373 on macfellows.local: Created './standalone/darwin-1.54.4/bin/pact-provider-verifier 'https://test.pact.dius.com.au/pacts/provider/node-message-provider/consumer/node-message-consumer/version/1.0.1543124323' --broker-username 'dXfltyFMgNOFZAxr8io9wJ37iUpY42M' --broker-password 'O5AIZWxelWbLvqMd8PkAVycBJh2Psyg1' --publish-verification-results 'true' --provider-app-version '1.0.0' --provider-base-url 'http://localhost:54838''

By omitting the latest tag it will, ironically, automatically pick up the latest pact. I’ve happened to tag this pact as prod and so searching for that tag also works.

So this is definitely a bug, and the bug is in pact-node. I’ll move the issue and get it fixed - thanks for the report!

0reactions
mefellowscommented, Apr 11, 2019

I think this issue is resolved now @thombergs - can you please confirm?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Message Provider Validation against Pact Broker Wrongly ...
I have a strange behavior during message provider verification. I successfully published a message pact to my test pact broker instance (v ...
Read more >
FAQ | Pact Docs
During pact verification, Pact does not test the side effects of a request being executed on a provider, it just checks that the...
Read more >
Regarding pact provider test - Stack Overflow
I am using working on the contract testing in nodejs using pact, ... see a message "INFO: Publishing verification result [success: true, ...
Read more >
stub - Pactflow Documentation
The focus on the messages (request/response), not the implementation. ... Use the pact generated by the unit tests along with a pact stub...
Read more >
Consumer-driven contract testing with Pact - codecentric Blog
The next step is to execute the provider tests against your Pact file. If the provider verification is successful it means that the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found