Skip to content

Expected repeated field 'x' to be empty but received 1 values #45

@stan-is-hate

Description

@stan-is-hate

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:

  • If you omit a repeated field (tags) in the request (in TestSaveFeature), the test will fail with:
    Failed to match the request message - BodyMismatches({"$.tags": [BodyMismatch { path: "$.tags", expected: None, actual: 
    None, mismatch: "Expected repeated field 'tags' to be empty but received 1 values" }]})
    
  • If you omit a repeated field (tags) in the expected response (in either test):
    • consumer test passes
    • but provider test fails with:
       Expected repeated field 'tags' to be empty but received 1 values
      

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingsmartbear-supportedIssues with this label have been added to the Pactflow team's Jira backlog

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions