Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provider verifier verifies multiple consumers if PACT file is given #447

Open
judimator opened this issue Jan 16, 2024 · 3 comments
Open

Comments

@judimator
Copy link

Initial state

  • pact-php:^9.0
  • One provider, called Provider 1
  • Multiple consumers for Provider 1, call them Consumer1, Consumer2
  • Pacts of Consumer1, Consumer2 are published. Contract for Consumer2 is not valid for Provider 1

Step to reproduce

  • Run the following script
$config = new VerifierConfig();
$config
    ->setProviderName('Provider1')
    ->setProviderVersion(getenv('PACT_PROVIDER_VERSION'))
    ->setProviderBranch(getenv('PACT_PROVIDER_BRANCH'))
    ->setProviderBaseUrl(new Uri('http://localhost:7202'))
    ->setBrokerUri(new Uri(getenv('PACT_BROKER_URL')))
    ->setBrokerUsername(getenv('PACT_BROKER_HTTP_AUTH_USER'))
    ->setBrokerPassword(getenv('PACT_BROKER_HTTP_AUTH_PASS'))
    ->setPublishResults(true)
    ->setVerbose(true)
    ->setProviderStatesSetupUrl('http://127.0.0.1:7202/states/');

$verifier = new Verifier($config);
$verifier->verify('Consumer1', null, getenv('PACT_CONSUMER_VERSION'));

Expected result

  • Only contract for Consumer1 verified

Actual result

  • Contract result for Consumer2 presented in verification output
@mefellows
Copy link
Member

Looking at the following line, I can't quite see how that could find other consumers - unless there is a bug in the broker (doubtful):

public function verify(string $consumerName, string $tag = null, string $consumerVersion = null): self

Can you please share some logs with verbose/debug logging enabled to help us understand what calls are being made to the broker?

@mefellows
Copy link
Member

Ah, I suspect that because the Verifier has been given a broker URL, it is also dynamically fetching pacts. The logs and terminal will show this, however.

@judimator
Copy link
Author

@mefellows Yeah, I think that is the cause, so if broker data given it tries to verify not only given file but all pacts as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants