Hi Pact Team, I am writing a consumer test in go u...
# pact-go
w
Hi Pact Team, I am writing a consumer test in go using the new gRPC workflow. I am trying to call (*message.SynchronousPact).AddSynchronousMessage() twice within the same test because my gRPC server has multiple RPCs. When I run the test with just one call to (*message.SynchronousPact).AddSynchronousMessage() the test passes and a valid pact is generated but I still see this log
Copy code
2023-07-13T16:02:55.872397Z ERROR ThreadId(01) pact_mock_server::server_manager: Failed to shutdown plugin mock server with ID 97fa0c1e-3e37-4199-807f-3c16e3c0a94c - transport error
If I add a second call to (*message.SynchronousPact).AddSynchronousMessage() the test fails due to this error
Copy code
2023-07-13T16:02:56.418779Z ERROR ThreadId(01) pact_ffi::plugins: Mock server is already started
Is this a known issue or is there some workaround. - Thanks. Cc: @Sathish Sundararajan @Jason Taylor
For context, basically if you have multiple (*message.SynchronousPact).AddSynchronousMessage() calls within the same go test, e.g. func TestConsumer(t *testing.T){…} you will get the above errors.
m
Perhaps we need to handle that situation better. Could you please raise an issue? This being said do you really need them in the same test? They will be tested separately on the provider aide
w
Yes will raise an issue for this. Also yes the separating the calls in to multiple tests works, however, for my use case it would be ideal to call AddSynchronousMessage() twice within the same test to the same *message.SynchronousPact.