Hello everyone, i was tasked after defining contra...
# general
f
Hello everyone, i was tasked after defining contract testing with messaging pacts in our company to try adding contract testing to on of our C++ projects. But if i look at the repo it seems that there is no support? anymore. Is the current state even able to do provider tests especially with messaging pacts? And what would be a good alternative to go at this problem? Thank you in advance for your time :)
m
It's not unsupported, but we tend to build features as they become useful to somebody. Message pact may not have been added yet. You can also do provider side testing via the verifier CLI. There were some updates in #CPGH2TLLX recently as I think there were some contributions happening
(I was wrong, but there was a conversation somewhere recently!)
f
Hello Matt thank you for that information. I will look into doing provider side testing via CLI thank you.
y
The existing project, https://github.com/pact-foundation/pact-cplusplus Only caters for the consumer side, and uses an old version of the pact_ffi library. I would imagine that writing a new library wrapper over libpact_ffi c shared library might be a smarter move. The verifier side, is fairly trivial to implement in terms of the call composition. The latest verifier cli
pact_verifier_cli
https://docs.pact.io/implementation_guides/overview#cli-tooling supports message testing, you will need to stand up a message proxy to listen to the requests from pacts verifier, and map those to message producers in your code, and return the response as http https://github.com/pact-foundation/pact-reference/tree/master/rust/pact_verifier_cli#verifying-message-pacts Normally the message proxy would be stood up by the client language implementation on behalf of the user, and allow mapping of descriptions to functions
f
Hey just wanted to update that it worked perfectly for our use case. I wrote a small golang wrapper that handles the http communication with the verifier cli which makes it easier for our c++ developers to integrate contract testing. So i can say we are successfully starting contract testing even with our c++ devs ^^ The verifier cli works wonderfully
m
Fantastic! Thanks for reporting back 👍
Would love to hear more about your use case if you’re willing to share?
f
Currently its not much but we are trying to establish contract testing. We have a big medical system consisting of many microservices. Often communicating via MQTT, Websockets, SSE. And especially because so many systems are connected with each other and a few of the services our developed from teams at other departments in the world (where sadly many teams dont or cant follow specifications etc), Integration Testing becomes quite tedious to set up and run. And messaging Pacts are really their gold worth here. The potential combined with the Pact Broker which i let set up with a future student project and discover all its potential will change a lot at our development processes. The golden Plan would be to fully integrate it in the lifecycle with automatic deployment and validation but sadly this will probably still take some time until it bears fruit 🙂
m
Ah, that’s fantastic to hear! Thanks for sharing Fabian 🙏