-
-
Notifications
You must be signed in to change notification settings - Fork 480
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
Cannot mix message and rest pacts #610
Comments
This is by design, as we feel that synchronous and asynchronous contract tests should be separate. Could you expand on your requirement to mix them? |
|
I have done this with having two different consumer names (like consumer and consumer-amqp). The reason we keep them separate is the different types of pacts have to be verified in a different manner. |
Using two different consumer names for the same service also breaks a bit the network graph on pact broker side. |
@uglyog Just wondering if there's no other way to distinguish between messaging and HTTP style pacts? From the perspective of a user of this library, the consumer name should ideally be the name of the application. Requiring two different names for a consumer application such as "some-app" and "some-app-messaging" feels a bit unnatural. For example, attempting to follow the advice from https://docs.pact.io/best_practices/pact_nirvana#6-use-tags-to-ensure-your-provider-is-compatible-with-your-production-consumer appears to make the process more complicated when an application can potentially have two associated consumer names. |
The problem is the verification tooling expects one or the other. It either interacts with a running HTTP server or it invokes methods to get message payloads. It is all setup in the beginning of the verification process before any pact file is loaded, and will require a big change to be able to do both from the contents of one pact file. |
Two big downsides:
|
A third downside:
@uglyog I understand your reasoning of splitting sync and async tests. But this should not stand in the way of naming your consumer with 1 unique name. Maybe its possible to add the type of contract as an extra parameter? (to the name of the json file and in the content itself) |
@peternelissen I have no issue with merging the different types of interactions into one file, but the problem is that will require a change to the file format and need to be implemented across about nine language implementations. It's something that needs be to tracked from the specification project https://github.com/pact-foundation/pact-specification. |
@uglyog I understand that implementing this is very complicated. |
@bethesque thoughts? |
@broeser we plan to add support to the Pact Broker for multiple types of pacts between the same consumers, but I cannot give you any estimate of when it's going to be picked up I'm afraid. Here is the feature request: https://pact.canny.io/feature-requests/p/support-multiple-protocols-of-pact-for-the-same-application |
Honestly not a big deal to have to use different consumer/provider names, even though not ideal, but having to modify our CI/CD setup to account for this is quite painful. |
Linking #1376 |
@uglyog I see this one https://pact.canny.io/feature-requests/p/support-multiple-protocols-of-pact-for-the-same-application is ready in Pact, when can we receive support for this feature in pact-jvm? Or it should work automatically? |
@artamonovkirill You will need to use V4 Pacts, it should work but this has not been tested fully, so there may still be some areas that don't support it. |
Hey @rholshausen It seems that generating the Pact file containing both HTTP and message interactions on the consumer side works fine in V4, good job with that 👍 But how can both of these types of interaction be tested on the provider side? I cannot have it in one test, cause I need to set one, specific target on the context. And I cannot split it into two tests, because each test executes all contracts, so unavoidably, in each test class contracts of the other target will fail 🤔 |
@misko321 as a workaround before #1708 is implemented you might use two different test classes with distinct @PactFilter annotations. We use
|
The text was updated successfully, but these errors were encountered: