Cody A. Ray
10/23/2023, 9:07 PMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
1. Is it possible to expose the Pact interaction file parser (or get a code pointer to it)
a. If not, do you know how often the pact parsing logic changes?The specification governs the pact file format: https://github.com/pact-foundation/pact-specification/ The JSON schema there might be the best starting point.
Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Cody A. Ray
11/02/2023, 8:18 PMStanislav Vodetskyi
11/02/2023, 8:22 PMmetadata.plugins
field - like grpc plugin puts proto filedescriptor set plus the proto itself there.
How much work would it be to have stub server support plugins?Cameron Trando
11/06/2023, 7:22 AMYousaf Nabi (pactflow.io)
Moreover, even if we migrate people to contract testing, if provider verification is performed on a service with unrealistic mocks, then the pacts can’t be trusted either (correct me if I’m wrong here).why would this be the case? the pacts are generated from real services in a unit test and verified against a real service which is running locally. if you are verifying against a service that is mocked what are you checking? that sounds like a recipe for drift, unless i’m missing something here
Cameron Trando
11/06/2023, 4:56 PMwhich types of provides are you mocking? currently the stub server is built for http interactions. there was a request for a stub server to be built for, or the existing extended to cover grpc.We’re mocking interactions between grpc clients.
there is already tooling to generate grpc
mocks and you could use pact to verify these if required.Can you elaborate more on this? Do you mean using something like gomock?
why would this be the case? the pacts are generated from real services in a unit test and verified against a real service which is running locally.In order to run the pacts against our real service, we have to get our real service running locally, which requires mocking out its dependencies. So if the mocks necessary to have our service run locally aren’t high fidelity, then it’s difficult to trust that the pact was verified on the provider side
if you are verifying against a service that is mocked what are you checking? that sounds like a recipe for drift, unless i’m missing something hereIt’s not that the service is mocked, it’s that the service dependencies are mocked in order to get it to run locally
Yousaf Nabi (pactflow.io)
there is already tooling to generate grpc mocksHere are a few that I’ve bookmarked in the past, or listed via https://github.com/grpc-ecosystem/awesome-grpc#tools • https://github.com/testinggospels/camouflage • https://github.com/tokopedia/gripmock • https://github.com/Fadelis/grpcmock • old - https://github.com/carvalhorr/protoc-gen-mock • https://github.com/bradleyjkemp/grpc-tools • https://learning.postman.com/docs/sending-requests/grpc/using-grpc-mock/ So your provider code, depends on other grpc services, which are being mocked out? and you are lacking confidence in these mocks?
Yousaf Nabi (pactflow.io)
In order to run the pacts against our real service, we have to get our real service running locally, which requires mocking out its dependencies. So if the mocks necessary to have our service run locally aren’t high fidelity, then it’s difficult to trust that the pact was verified on the provider sidePact isn’t a replacement for functional tests, there should be sufficient functional testing of your provider to ensure it can fulfil its purpose. Pact has a side effect of functionally testing your provider. You can generate Provider verification tasks that provide little confidence as they touch too little of the application, that is plausible, but not something a tool can help with I don’t think
Yousaf Nabi (pactflow.io)
Cameron Trando
11/06/2023, 5:16 PMYousaf Nabi (pactflow.io)
Yousaf Nabi (pactflow.io)
Yousaf Nabi (pactflow.io)
Cameron Trando
11/06/2023, 5:20 PMI believe, you may need to convert the pact interaction into the format required by one of the mocking tools.do you know if anyone has tried this before?
Yousaf Nabi (pactflow.io)
Yousaf Nabi (pactflow.io)
Cameron Trando
11/06/2023, 5:24 PMYousaf Nabi (pactflow.io)
Yousaf Nabi (pactflow.io)
Yousaf Nabi (pactflow.io)
Stanislav Vodetskyi
11/06/2023, 11:48 PMPact isn’t a replacement for functional tests, there should be sufficient functional testing of your provider to ensure it can fulfil its purpose.Yeah, 100%. I believe you folks discussed this above, might've missed some of the posts. Basically we were thinking along the lines of - if in my functional tests I mock out a service with which I already have pact contract tests, can I reuse these pacts to either (a) generate mocks from the pacts, which means they satisfy the contract and we have confidence; or (b) use existing pacts to verify the mocks generated by a 3rd party tool. Just to have confidence that the mocks behave in the same way the real services do, to a reasonable extent.
Matt (pactflow.io / pact-js / pact-go)
To kinda take a step back here, pact consumer tests already run a mock server under the hood, it’s just configured for a single interaction. Is the stub server based off the same codebase? I’m just wondering on how much work to be to either grab the built-in mock server from consumer tests and expand it to multiple interactions; or add plugin support to stub server.Yes, you can see the stub server uses some of the key libraries of the core.
Matt (pactflow.io / pact-js / pact-go)