Robert Henzel
08/12/2022, 8:54 AM"bulk_addresses": [
{
"id": "matching(type, '00000000-0000-0000-0000-000000000004')",
"title": "matching(type, 'resTitle')",
"first_name": "matching(type, 'resFirstName')",
"middle_name": "matching(type, 'resMiddleName')",
"address_line1": "matching(type, 'resAddressLie1')"
}
]
When a field is set as repeated
in proto file, the changes in consumer grpcInteraction does not have a impact on provider test. As soon as I remove the []
the test behaves as it should.uglyog
Robert Henzel
08/15/2022, 8:05 AM"bulk_addresses":
{
"id": "matching(type, '00000000-0000-0000-0000-000000000004')",
"title": "matching(type, 'resTitle')",
"first_name": "matching(type, 'resFirstName')",
"middle_name": "matching(type, 'resMiddleName')",
"address_line1": "matching(type, 'resAddressLie1')"
}
But if I add the brackets, no matter how is the provider response data defined the test always passes.uglyog
Robert Henzel
08/17/2022, 11:52 AMRobert Henzel
08/17/2022, 11:54 AMuglyog
Robert Henzel
08/18/2022, 8:11 AMuglyog
grpcInteraction := `{
"pact:proto": "` + path + `",
"pact:proto-service": "Calculator/calculateMulti",
"pact:content-type": "application/protobuf",
"request": {
"shapes": [
{
"rectangle": {
"length": "matching(number, 3)",
"width": "matching(number, 4)"
}
},
{
"square": {
"edge_length": "matching(number, 3)"
}
}
]
},
"response": {
"value": [
{
"id": "matching(regex, '\\d+', '1234')",
"shape": "matching(type, 'rectangle')",
"value": "matching(number, 12)"
},
{
"id": "matching(type, '4')",
"shape": "matching(type, 'square')",
"value": "matching(number, 9)"
}
]
}
}`
uglyog
Verifying a pact between grpc-consumer-go and area-calculator-provider
calculate rectangle area request
Given a Calculator/calculateMulti request
with an input .area_calculator.AreaRequest message
will return an output .area_calculator.AreaResponse message [FAILED]
generates a message which
has a matching body (FAILED)
Failures:
1) Verifying a pact between grpc-consumer-go and area-calculator-provider - calculate rectangle area request
1.1) has a matching body
$.value[0].id -> Expected '0abc' to match '\d+'
There were 1 pact failures
uglyog
uglyog
Failures:
1) Verifying a pact between grpc-consumer-go and area-calculator-provider - calculate rectangle area request
1.1) has a matching body
$.value[0].id -> Expected '1234' to be equal to '0abc'
$.value -> Expected repeated field 'value' to have 1 values but received 2 values
$.value[0].shape -> Expected 'rectangle' to be equal to 'box'
uglyog
uglyog
"value": {
"pact:match": "eachValue(matching($'area'))",
"area": {
"id": "matching(regex, '\\d+', '1234')",
"shape": "matching(type, 'rectangle')",
"value": "matching(number, 12)"
}
}
uglyog
Robert Henzel
08/26/2022, 7:08 AM