-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expected repeated field 'x' to be empty but received 1 values #45
Comments
With the latest version of the plugin (0.3.12), changing the test to grpcInteraction := `{
"pact:proto": "` + path + `",
"pact:proto-service": "RouteGuide/SaveFeature",
"pact:content-type": "application/protobuf",
"request": {
"name": "notEmpty('A shed')",
"location": {
"latitude": "matching(number, 99)",
"longitude": "matching(number, 99)"
},
"tags": "eachValue(matching(type, 'I am a tag'))"
},
"response": {
"name": "notEmpty('A shed')",
"location": {
"latitude": "matching(number, 99)",
"longitude": "matching(number, 99)"
},
"tags": "notEmpty('I am a tag')"
}
}` then both consumer and provider pass. |
It might be the handling of default values that is causing the error when you leave the tags out of the request |
👋 Hi! The 'smartbear-supported' label has just been added to this issue, which will create an internal tracking ticket in PactFlow's Jira (PACT-1788). We will use this to prioritise and assign a team member to this task. All activity will be public on this ticket. For now, sit tight and we'll update this ticket once we have more information on the next steps. |
0.3.13 has been released |
I've done a basic test inside pact-go and it seems to have been fixed, thanks @rholshausen ! |
I'm still seeing it in one of my projects though, will investigate if it's related to a specific proto layout, something inside our codebase or something else. |
Ah, so it seems to be fixed for the case of default values, but there's still the case of when the consumer doesn't care about whether the field is present in the response or not, but the provider returns some value. |
Here's the demo code: https://github.com/stan-is-hate/pact-go/pull/1/files
You can run
make demo-error
to check these scenarios.I've discovered this error when I was testing a case where a provider returns a repeated string field (similar to tags) that consumer doesn't care about, so I didn't specify it in the consumer at all.
Turns out it's an issue even when the provider doesn't actually send back any value:
The text was updated successfully, but these errors were encountered: