Open prashanth-sams opened 3 years ago
Have the same problem
@mefellows any ideas?
This is reproduced when two pacts are specified with the same provider. Any chance to fix this?
@SergeyPirogov @prashanth-sams I figured out, you should combine all provider methods in single pact
builder
.uponReceiving("User request by phone")
...
.uponReceiving("User request by email")
...
.toPact()
@DNAlchemist Does this mean I need to write all my consumer contracts in one super-long class? We have a api gateway design for our microservices, where the gateway could make requests to three different microservices/providers with a total of five requests.
@PactTestFor(pactMethods = {"countryDetails", "countryDetails2"})
refers only to methods in the same class, no?
This class will be ridiculously big in the end if that's the case.
👋 Hi! The 'smartbear-supported' label has just been added to this issue, which will create an internal tracking ticket in PactFlow's Jira (PACT-927). We will use this to prioritise and assign a team member to this task. All activity will be public on this ticket. For now, sit tight and we'll update this ticket once we have more information on the next steps.
See our documentation for more information.
@Yrlish what @DNAlchemist is saying is that you can combine the two methods into one which sets up both interactions and you won't be affected by this issue, because the issue here as reported is where the provider is the same for both methods. It does not make sense to have two different methods for the same provider.
If you have different providers, then you have to have different Pact methods, but then the provider names will be different so you won't be affected by this issue.
@rholshausen Hi Ronald! So you're saying that the pattern of having one method for each endpoint is bad? If I have one method containing 20+ interactions of each different endpoint paths, how would I test this with the @PactTestFor
annotation?
No, we are saying there is a work around while this issue is being fixed. The original example did not need multiple Pact methods (the ones annotated with @Pact
) because the provider was the same.
My consumer test
Pact-JVM version: 4.2.12
Error Log