Hey, I don’t understand why this pact is still in ...
# pact-broker
b
Hey, I don’t understand why this pact is still in a pending state when it has been verified for the
refs/heads/feature/testing
branch. Any help would be greatly appreciated.
m
providerVersionTags is not the same as branch
Actually, can you please share the notices in that response? They should explain why the pact is pending
b
The provider branches and tags are the same value, but I had to use providerVersionTags as the JVM libraries don’t support providerVersionBranches as far as I can see
Oops, mixed up consumer and provider when I masked out the sensitive info:
Copy code
"notices": [
    {
        "when": "before_verification",
        "text": "The pact at <https://pact-broker/pacts/provider/PROVIDER-SERVICE/consumer/CONSUMER-SERVICE/pact-version/784335ccca070ed0a4fec7cd3667e24ac57b4c06/metadata/d2lwPXRydWU> is being verified because it is a 'work in progress' pact (ie. it is the pact for the latest version of CONSUMER-SERVICE from branch 'refs/pull/122141/merge' and is still in pending state). Read more at <https://docs.pact.io/go/wip>"
    },
    {
        "when": "before_verification",
        "text": "This pact is in pending state for this version of PROVIDER-SERVICE because a successful verification result for a version of PROVIDER-SERVICE with tag 'refs/heads/feature/testing' has not yet been published. If this verification fails, it will not cause the overall build to fail. Read more at <https://docs.pact.io/go/pending>"
    },
    {
        "when": "after_verification:success_true_published_false",
        "text": "This pact is still in pending state for any version of PROVIDER-SERVICE with tag 'refs/heads/feature/testing' as the successful verification results with this tag have not yet been published."
    },
    {
        "when": "after_verification:success_false_published_false",
        "text": "This pact is still in pending state for any version of PROVIDER-SERVICE with tag 'refs/heads/feature/testing' as a successful verification result with this tag has not yet been published"
    },
    {
        "when": "after_verification:success_true_published_true",
        "text": "This pact is no longer in pending state for any version of PROVIDER-SERVICE with tag 'refs/heads/feature/testing', as a successful verification result with this tag has been published. If a verification for a version of PROVIDER-SERVICE with this tag fails in the future, it will fail the build. Read more at <https://docs.pact.io/go/pending>"
    },
    {
        "when": "after_verification:success_false_published_true",
        "text": "This pact is still in pending state for any version of PROVIDER-SERVICE with tag 'refs/heads/feature/testing' as a successful verification result with this tag has not yet been published"
    }
]
Changing the query to providerVersionBranches instead of providerVersionTags with the same value returns the same result.
The
This pact is still in pending state for any version of PROVIDER-SERVICE with tag 'refs/heads/feature/testing' as a successful verification result with this tag has not yet been published
claim seems to be false based on what I’m seeing in the UI. Not sure if I’m missing something though.
m
@Beth (pactflow.io/Pact Broker/pact-ruby) might need to jump in here, sorry Ben
b
@Ben Pilgrim that doesn't seem right to me either. I would need to be able to debug your data locally to work out exactly why it's going wrong however.
You can try and reproduce the issue using this https://github.com/pact-foundation/pact_broker/blob/master/ISSUES.md
Or you can give me a redacted dump of your database using this script https://github.com/pact-foundation/pact_broker/blob/master/script/prod/redact-data.sql (you'll need to leave enough data unredacted to still perform the correct query or work out how to recreate the issue with the redacted data)
b
Copy code
td.delete_pacticipant("foo-consumer-1")
    .delete_pacticipant("bar-provider-1")
    .publish_pact(consumer: "foo-consumer-1", consumer_version: "1", provider: "bar-provider-1", content_id: "111", branch: "feat/x")
    .get_pacts_for_verification(
      enable_pending: true,
      provider_version_tag: "feat/y",
      include_wip_pacts_since: "2020-01-01",
      consumer_version_selectors: [{ branch: "main" }]
    )
    .verify_pact(
      index: 0,
      provider_version_tag: "feat/y",
      provider_version: "1",
      success: true
    )
    .get_pacts_for_verification(
      enable_pending: true,
      provider_version_tag: "feat/y",
      include_wip_pacts_since: "2020-01-01",
      consumer_version_selectors: [{ branch: "main" }]
    )
Happy to raise a git issue if that’s more appropriate
Looks like it works as I would expect if the consumer_version_selectors match the consumer branch the pact is published too, but not if they differ
b
@Ben Pilgrim I can see why the messaging is confusing.
Ideally, the messaging would indicate that it has successfully been verified, but is still WIP because it has not been verified when explicitly selected yet.
For the WIP pacts, the pending flag is hardcoded to true.
We went backwards and forwards about whether it should remain pending after a successful WIP verification, and for reasons I cannot recall off the top of my head right now, it was decided it was best to leave it as pending.
Basically, a pact will stay WIP and pending until it has been merged into the main branch.
I've updated the text, but I'm not sure if it helps or not!
Copy code
The pact at <http://pact> is being verified because it is a 'work in progress' pact (ie. it is the pact for the latest versions of Foo from branch 'feat-x' and it has not yet been successfully verified by a version of Bar from branch 'feat/z' when the pact's application version was explicitly specified in the consumer version selectors). Read more at <https://docs.pact.io/go/wip>
b
Ah okay, thanks for the clarification.
b
I'm glad you raised it because that message needed updating.