now that I’ve managed to <get things to compile in...
# pact-plugins
f
now that I’ve managed to get things to compile in C++ with a recent pact_ffi version, the next hurdle seems to be the pact-cplusplus interface doesn’t actually seem to trigger anything in the plugin interface. I have figured out a workaround by calling
pactffi_using_plugin
and passing in the handle, and it actually loads the plugin and calls
InitPlugin
, but now I’m at a loss… My assumption is the pact-cplusplus is so far out of date it doesn’t actually call any of the methods in the ffi interface to result in the plugin being called with
ConfigureInteraction
,
StartMockServer
, etc. Is that a correct assumption? Where can I find some example code to follow for setting up a transport plugin, so I can figure out what the C++ wrapper should look like to work with plugins?
pact-go / pact-js / pact-php have interfaces for using plugins via the ffi, if you want to see real world implementations.
we have planned to build out a maintainer guide for the ffi but time gets swallowed up by other things
f
Thanks, I tried poking around in pact-js and the rust consumer but didn’t get very far 😄 That C# code looks like just what I need for now!
y
awesome. and yeah it’s definitely a maze for sure! sometimes you just need to see the few calls you need to make and you can build out your mental model from there.
f
Is this page still valid btw? https://github.com/pact-foundation/pact-plugins/blob/main/docs/protocol-plugin-design.md I’m following the approach in the
GrpcGreeterClientTest.cs
that sets the interaction_content, and that seems to start the mock server with the specified content in the request payload for the
StartMockServer
rpc. I was expecting
ConfigureInteraction
to be called at some point so I can set up the expected requests/responses? I stripped the “pact:proto” and “pact:proto-service” btw, not sure how relevant that is, since it’s not a grpc service being tested.
y
this is the consumer facing dsl for the pact framework. the configureinteraction is a plugin method and that is being dealt with by the pact-protobuf-plugin for a course of plugin design you can follow https://docs.pact.io/plugins/workshops/create-a-plugin/intro where you will see those methods implemented, and you will end up with a plugin you can call from your pact tests
f
Somehow I completely missed that course… thanks for pointing that out! I was only aware of the pages here https://docs.pact.io/implementation_guides/pact_plugins
r
We didn't think anyone was using the C++ version of Pact, it has been very quite for years.