Hi Team, I do have a provider service which publis...
# pactflow
j
Hi Team, I do have a provider service which publishes more than one openapi sec. So could you please tell me whether we can publish more than one openapispec contract for a provider? OR do you have any suggestion how to handle these scenario?
m
We only support one: https://docs.pactflow.io/docs/bi-directional-contract-testing/contracts/oas#document-limitations Can you please elaborate on your use case?
j
Hi @Matt (pactflow.io / pact-js / pact-go) - We build API which can have different swagger endpoints for external(customer facing) and internal to the company.
Also, if the same microservice acts as an consumer and provider with different interaction types (synchronous and message based), can we use the same name for all these interactions OR do we need to specifiy different names.. any thought
m
You have a couple of choices, I think 1. Merge them together before uploading to PactFlow 2. Name them as separate providers in PactFlow (e.g. provider-internal and provider-public)
Also, if the same microservice acts as an consumer and provider with different interaction types (synchronous and message based), can we use the same name for all these interactions OR do we need to specifiy different names.. any thought
BDCT does not support async, it only supports HTTP APIs
If you’re referring to Pact tests, in V4 you can combine them. Prior to that you need to name them separately
j
V4 mean that Pact specification version.correct? We are using Pact.Net which doesnt support V4 yet. So I think, I may need to use different names for provider and consumer. Does this applicable to BDCT as well. I read somewhere that it is applicable for message based interactions? i.e. For BDCT, if microservice A acts as a provider (using BDCT) and also consumer of Microservice B, then do I need to use different names?
m
BDCT doesn’t support async/message based interactions, those requests are ignored
j
I meant for HTTP based interactions.Sorry if it is sounded for messaged testing....... if microservice A acts as a provider (HTTP based interaction using BDCT) and also consumer of Microservice B, then do I need to use different pacticipant name for microservice A i.e. like microserviceA-provider & microserviceA-Consumer..
m
i.e. For BDCT, if microservice A acts as a provider (using BDCT) and also consumer of Microservice B, then do I need to use different names?
You shouldn’t need to, no
🙌 1
j
@Matt (pactflow.io / pact-js / pact-go) - I was testing HTTP based and message based interaction for a microservice and facing the below issues. I am using PactNet (5.0-beta) and PactV4. Could you please review and provide your inputs, if I am missing something in the implementation? My test pactflow account is https://jp.pactflow.io/. Scenario: I have "catalog" microservice which acts a provider (BDCT) with the pacticipant name "catalog-api". This same microservice will also acts as message based provider (for 2 event types - ServiceCreate & ServiceDelete). I planned to use the same pacticipant name "catalog-api" for message based interaction as well. Issue Description: 1. When I use the same pacticipant name "catalog-api", the message based interactions are automatically getting verified based on the OAS document published as part of BDCT. But I was expecting that the message based interactions shouldnt be verified against OAS contract and wait until I run the Provider verifier tests for "catalog-api" events. 2. To work around the issue#1, I published the consumer contracts with a different pacticipant name for "catalog-api" i.e. "catalog". I couldnt include 2 different events (i.e. ServiceCreate & ServiceDelete) in the same consumer contract and run the Provider verifications tests. The tests are failing with the generic error message "Pact net verification failed". But when I include only one event type in the contract, the provider tests are running successfully without any issues.
m
1. When I use the same pacticipant name “catalog-api”, the message based interactions are automatically getting verified based on the OAS document published as part of BDCT. But I was expecting that the message based interactions shouldnt be verified against OAS contract and wait until I run the Provider verifier tests for “catalog-api” events.
Yes this is tricky. the BDCT verification ignores non-HTTP based interactions so it will be “green” even though the messages aren’t included. This is because BDCT workflows need not have a Pact verification step.
Creating 2 pacticipants is probably the way to go. We have been thinking on the best way to resolve this, but we will need to as we add different contract types into the system
j
Thanks for your feedback. I will try creating a support request for further tracking on the issue# 1. Also, could you please provide some light on the issue# 2 i.e. I couldnt have more than 1 event type in the same interaction.
m
1. To work around the issue#1, I published the consumer contracts with a different pacticipant name for “catalog-api” i.e. “catalog”. I couldnt include 2 different events (i.e. ServiceCreate & ServiceDelete) in the same consumer contract and run the Provider verifications tests. The tests are failing with the generic error message “Pact net verification failed”. But when I include only one event type in the contract, the provider tests are running successfully without any issues.
I’m not sure what the problem is from this description. It should work. So it’s either: 1. A bug in your setup 2. A bug in Pact .NET To understand what the problem is, we’d need to a repro and a bug report on GitHub please
I will try creating a support request for further tracking on the issue# 1
You could consider raising a feature request. I also will add it on our internal insights board for consideration