Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
pactffi_interaction_contents
is the interface for a content type plugin, and we’d add a new ffi interface for a transport plugin? i.e. you would want to use these things together, but I can’t see how this interface would support something like gRPC.
If that’s the case, then the current PactHandle methods aren’t going to look very sensible.
i.UponReceiving("some interaction").
Given("plugin state").
WithRequest("GET", "/protobuf").
WithStatus(200).
WithPluginInteractionContents(INTERACTION_PART_RESPONSE, "application/protobuf", protobufInteraction)
That’s the example Golang plugin test I ran before which worked 👌
But assuming that gRPC would have a separate interface, e.g. pactffi_plugin_transport
or something?
i.UponReceiving("some grpc interaction").
Given("plugin state").
WithPluginTransport("grpc", <some json configuration object?>)
WithPluginInteractionContents(INTERACTION_PART_RESPONSE, "application/protobuf", protobufInteraction)
uglyog
Matt (pactflow.io / pact-js / pact-go)
uglyog
Matt (pactflow.io / pact-js / pact-go)
{
state: 'i have a list of projects',
uponReceiving: 'a request for projects',
withRequest: {
method: HTTPMethods.GET,
path: '/projects',
headers: { Accept: 'application/json' },
},
willRespondWith: {
status: 200,
headers: { 'Content-Type': 'application/json' },
body: {},
},
};
This makes it super easy to convert other JSON structures to a Pact interaction.
But you can see how the validation on this sort of structure would get super messy with plugins (and indeed, some of the features in v3). I’ll probably preserve it for HTTP pact, but I’d like a more type safe API going forward if possible. e.g. you shouldn’t be able to add an HTTP header to a message pact. Or, if using a different transport, you shouldn’t be configuring other things on the HTTP mock serverSlackbot
03/20/2022, 11:30 PM