PACT Node - ConsumerVersionSelector - Pacticipant and Version Not Honored

241 views Asked by At
  • OS: Mac OSX 10.15.7_
  • Pact: 9.15.5
  • Pact Node version: 10.12.2
  • Node Version: 12.13.0

Im sure I'm doing something wrong, but I'm not sure how to get that working.

I have 2 clients (ClientA and ClientB) that have contracts (each tagged 'master') published to the pact broker (version 2.79.1) with provider DemoService.

Pact-Broker Matrix (simplified):

Consumer Version Tag Provider Version Verified
ClientA 1.0.1-2726fe4 master - DemoService 1.0.0-a6b2678
ClientA 1.0.0-12ab763 master - DemoService 1.0.0-a6b2678
ClientB 1.0.1-6fe3cb5 master - DemoService 1.0.0-a6b2678
ClientB 1.0.0-ec71b62 master - DemoService 1.0.0-a6b2678

I try to setup a ConsumerVersionSelector to validate a specific version of a contract for ClientA with the provider.

import { Verifier} from "@pact-foundation/pact";
import { ConsumerVersionSelector } from "@pact-foundation/pact-node/src/verifier";

describe("PACT Verification", () => {
  test(`Validates the expectations of Provider: DemoService`, () => {   
    return new Verifier({
        providerBaseUrl: `http://${config.app_server_host}:${config.app_port}/`,
        pactBrokerUrl: 'https://local/pactbroker/',
        provider: 'DemoService',
        providerVersion: '1.0.0-a6b2678',
        providerVersionTags: 'master',

        logLevel: 'debug',
        logDir: 'log',

        consumerVersionSelectors: [{
          all: false,
          latest: false,
          tag: 'master',
          version: '1.0.0-2726fe4',
          pacticipant: 'ClientA'
        } as ConsumerVersionSelector],

        publishVerificationResult: true,
        pactBrokerUsername: 'admin',
        pactBrokerPassword: 'password',

      })
      .verifyProvider()
      .then((output) => {
        console.log(output);
      })
      .then(() => {
        expect("A").toEqual("A");
      });
  });
});

It looks like the version and pacticipant is not honored. Contracts for both consumers are pulled from the pact broker. The log has the following statement:

    
    DEBUG: The pact at https://local/pactbroker/pacts/provider/DemoService/consumer/ClientA/pact-version/1d59c1e8b3944bb34c72cafd0de47e0b07162685 is being verified because it matches the following configured selection criterion: pacts for all consumer versions tagged 'master'
    DEBUG: The pact at https://local/pactbroker/pacts/provider/DemoService/consumer/ClientB/pact-version/0713c326c33c47a08901c676c575244bfefd394a is being verified because it matches the following configured selection criterion: pacts for all consumer versions tagged 'master'

Thank you for commenting.

0

There are 0 answers