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.

Filtering by Consumers when loading from PactBroker is broken

See original GitHub issue

When loading pacts from the PactBroker, one can filter them by consumer(s) using the system-property:

-Dpactbroker.consumers=my-consumer-name

When doing this however, it always results in a “NoPactsFoundException”. Without this parameter, it does find the pact correctly for this consumer.

The reason seems to be in the PactBrokerLoader class, in line 195:

      if (pactBrokerConsumers.isNotEmpty()) {
        val consumerInclusions = pactBrokerConsumers.flatMap { parseListExpression(it, resolver) }
        consumers = consumers.filter { consumerInclusions.isEmpty() || consumerInclusions.contains(it.name) }
      }

According to my tests, “consumers” is a List of “PactBrokerResult” instances. The PactBrokerResult has a “name” field, but it contains the following text:

Pact between my-consumer-name (d49036c9b747af48c33fc66de0ddf7af57756c49) and my-provider-name

This text does NOT match the “consumerInclusions”, they merely contain “my-consumer-name”.

One solution could be to simply check that “my-consumer-name” is contained in the result’s name field in any position, but this sounds hacky, it would probably be better to load the specific pact from the broker and check the real consumer name, but that’s one call more for each consumer.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
anto-accommented, Oct 14, 2020

@artemptushkin 4.1.8 is out. I am going to close this based on your testing.

1reaction
anto-accommented, Oct 13, 2020

Amazing @artemptushkin ! Thank you so much for testing. I’ll try and release a new version when I get a chance, unless @rholshausen gets there before me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Filtering by Consumers when loading from PactBroker is broken
One solution could be to simply check that "my-consumer-name" is contained in the result's name field in any position, but this sounds hacky,...
Read more >
Is it possible to filter pact broker overview page/verification ...
It's totally doable. It's just a matter me (or someone else) having the time to do it. I've raised an issue for it...
Read more >
FAQ | Pact Docs
Configure a Pact Broker webhook to send a Slack message when a failed verification result is published. Configure the pact verification build to ......
Read more >
Frequently asked questions - Pactflow
Pact is an open source tool implemented in multiple languages that allows you to perform contract tests on an integration point using a...
Read more >
@pact-foundation/pact - npm
Consumer ; Provider (Producer); Pact Broker Integration. Matching ... Request Filters; Provider state callbacks.
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