Hi all, I'm currently implementing some protobuf c...
# protobufs
j
Hi all, I'm currently implementing some protobuf contract testing on our project. My understanding of a consumer contract is that it is the minimum information the consumer requires from the provider, but when we tried to make a change to the provider to include some new fields, we have downstream contracts (deployed and in main) using the old version of the consumer (without the new fields required) failing when the provider still provides the new and old fields. I believe we're running into a similar issue as https://github.com/pactflow/pact-protobuf-plugin/issues/45 I ran the provider tests in debug mode and found output as below - this shows the field numbers of the new fields we added.
Copy code
2925Z  WARN tokio-runtime-worker request{method=POST uri=<http://127.0.0.1:43899/io.pact.plugin.PactPlugin/VerifyInteraction> version=HTTP/2.0 headers={"te": "trailers", "content-type": "application/grpc", "authorization": Sensitive, "user-agent": "tonic/0.10.2"}}:decode_message: pact_protobuf_plugin::message_decoder: Was not able to decode field: Did not find a field with number 7 in the descriptor
2024-03-27T16:22:07.932940Z DEBUG          tokio-runtime-worker pact_plugin_driver::child_process: Plugin(protobuf, 247654, STDOUT) || 2024-03-27T16:22:07.932935Z  WARN tokio-runtime-worker request{method=POST uri=<http://127.0.0.1:43899/io.pact.plugin.PactPlugin/VerifyInteraction> version=HTTP/2.0 headers={"te": "trailers", "content-type": "application/grpc", "authorization": Sensitive, "user-agent": "tonic/0.10.2"}}:decode_message: pact_protobuf_plugin::message_decoder: Was not able to decode field: Did not find a field with number 8 in the descriptor
2024-03-27T16:22:07.932948Z DEBUG          tokio-runtime-worker pact_plugin_driver::child_process: Plugin(protobuf, 247654, STDOUT) || 2024-03-27T16:22:07.932944Z  WARN tokio-runtime-worker request{method=POST uri=<http://127.0.0.1:43899/io.pact.plugin.PactPlugin/VerifyInteraction> version=HTTP/2.0 headers={"te": "trailers", "content-type": "application/grpc", "authorization": Sensitive, "user-agent": "tonic/0.10.2"}}:decode_message: pact_protobuf_plugin::message_decoder: Was not able to decode field: Did not find a field with number 9 in the descriptor
I'm confused as to how we'd ever be able to deploy a change to the provider with new fields if the consumer is expecting an exact response rather than a minimum number of fields. I'd appreciate any help if I've either misunderstood or there is some kind of known issue with the protobuf plugin
r
Can you raise this as a GH issue?
j
Hi @rholshausen I've raised https://github.com/pactflow/pact-protobuf-plugin/issues/53 is there anything you can spot here or on the GH issue as something we've gotten wrong about the process? failing that, would you be able to explain how making and then deploying a contract change should work? That might help me apply the process to my current situation and see where I'm going wrong
r
Thanks you for that. This needs to be investigated, as adding a new field should be fine to do, it is an acceptable to expect the contract test to not fail. The problem is that the descriptors on either side will be different, and that is why it is failing. This is an issue particular to Protobufs.
j
I did add some more context to the issue yesterday in case you hadn't seen. We seem to have found where the problem is, (specific to boolean fields) and I've proved that the provider verification works against the old schema when removing this boolean field