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

Multiple Provider Verifier type support #179

Closed
ckotyan opened this issue Sep 3, 2019 · 6 comments
Closed

Multiple Provider Verifier type support #179

ckotyan opened this issue Sep 3, 2019 · 6 comments

Comments

@ckotyan
Copy link

ckotyan commented Sep 3, 2019

Software versions

  • MacOs
  • OS: Mac OSX 10.14
  • Library version: 8.2.6
  • Node Version: 10.16

Expected behaviour

The message Pact should only verify contracts for message type consumers contracts and Http REST provider tests should only verify REST call like PACT type consumer contracts.

Actual behaviour

I have a micro service which has REST endpoints as well as it publishes messages when certain event happens.
Hence I have 2 types of Providers in the PACT provider test suite: a MessagePact and a http REST pact; therefore there are 2 *Spec.js files. I am using the PACT broker to verify the providers. The issue I am seeing is when I run all the provider tests together, PACT fails the Message Pact tests while executing the REST provider pacts and vice versa.

My question is is this supported yet? if not is there a way to get around this issue? other than having different broker urls (1 for MessagePact and other for REST).

Steps to reproduce

This is the code snippet for running REST Pact provider verification: (providerPactSpec.js)

return new Verifier().verifyProvider({
            provider: serviceId,
            pactBrokerUrl: 'url',
            pactBrokerUsername: 'user',
            pactBrokerPassword: 'pwd',
            publishVerificationResult: false,
            providerVersion: `git short()`,
            timeout: 120000,
        });

And this is the code snippet for MessagePact provider verification (messagePactSpec.js).

            const messagePact = new MessageProviderPact({
                messageProviders: messageProviders,                
                provider: serviceId,
                pactBrokerUrl: 'url',
                pactBrokerUsername: 'user',
                pactBrokerPassword: 'pwd',
                publishVerificationResult: false,
                providerVersion: `git short()`,
                timeout: 120000,,
            });
            return await messagePact.verify();

Relevant log files

Will provide if needed

I am willing to contribute to help fix this if this is worth fixing.

@mefellows
Copy link
Member

mefellows commented Sep 3, 2019

At the moment, you'll need to give your provider a different name (e.g. MyProvider and MyMessageProvider and publish the contracts that way. This will prevent that overlap.

My understanding is that you can't have both message and http interactions stored in a single contract file.

cc: @bethesque - any additional thoughts?

@bethesque
Copy link
Member

We definitely want to support this use case. It's just a matter of finding the time. It will take a fair bit of work, because it's not just the publishing, it's also incorporating the results into can-i-deploy. I've raised an issue for it here but I'm not sure when it's going to get to the top of the priority list.

@ckotyan
Copy link
Author

ckotyan commented Sep 4, 2019

Hey @mefellows and @bethesque that was a very quick turnaround. Appreciate that. I will try different provider names and see if that resolves our issue.

@BenCrinion-IW
Copy link

Has there been any progress on this or do we still need separate providers for http and event contracts?

@mefellows
Copy link
Member

Yes, the progress is that this will be a feature in the v4 specification (see pact-foundation/pact-specification#79).

For clarity, it's currently not supported in Pact JS. Once the v3 version is live (which uses the new Rust core), when v4 closes, we can add that fairly quickly, along with plugins and other goodness.

@mefellows
Copy link
Member

Closing as the specification now supports this (as above) and this package supports it. It needs to be exposed in Pact JS.

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

4 participants