Hi again. Circling back to question 2 from my prev...
# protobufs
m
Hi again. Circling back to question 2 from my previous message, I see at this link https://github.com/pact-foundation/pact-specification/tree/version-4?tab=readme-ov-file#synchronousmessages that, technically, there is a pact specification for messaging where a consumer may send one message and receive back multiple messages. I am wondering, wouldn't this cover the case of server-side streaming communication (e.g. a
rpc SayHellos (HelloRequest) returns (stream HelloReply) {}
service)? Additionally, are there any examples or instructions on how to implement such a test for a gRPC consumer-provider pair (I am mainly interested in how the interaction would look in e.g. Go, to be able to generate a mock server, if possible)?
m
Yes, the model supports multiple responses, but the protobuf plugin itself does not support streaming: https://github.com/pactflow/pact-protobuf-plugin/?tab=readme-ov-file#unsupported-features
m
Does that mean that the pact model itself allows this, but the verification process does not? The way I tried it out is with a gRPC server that receives a name message and returns a stream of three greeting messages. Doing consumer testing, I noticed that only the first greeting seems to arrive from the mock provider at the client, but all three expected responses are printed in the pact file (maybe I am doing something wrong in my gRPC client implementation). Then when I perform provider verification using the newly generated pact file, I think only the first message is getting attention (when the first message is good but 2nd or 3rd are bad, it passes; when the first message is wrong, it fails).