hi pact-broker team! i didn't set any consumer ver...
# pact-broker
j
hi pact-broker team! i didn't set any consumer version selectors in my provider test. when i run the said test, i saw it makes a POST request to pb:provider-pacts-for-verification (path:
/pacts/provider/{provider}/for-verification
) with this body
Copy code
{
  "consumerVersionSelectors": [],
  "includePendingStatus": false
}
what default consumer version selectors does the pact broker use in this scenario if i didn't set it? is it below based on what i can deduce from the pacts it fetched for verification? thanks for your help! πŸ™
Copy code
{
  "consumerVersionSelectors": [
    {
      "mainBranch": true
    },
    {
      "deployedOrReleased": true
    }
  ]
}
tried looking at the docs but could only find the recommended values for consumer version selectors. tried looking at the code too but couldn't find my answer (or i'm just a ruby noob) πŸ˜…
m
Is there a reason why you aren't setting any selectors?
j
hey Matt! thanks for replying! ah we didn't set it since we can run our provider test without it. we're still tweaking our implementation though. we seem to be okay with whatever is the default behaviour based on the pacts it fetches for verification. however, we want to confirm exactly what are the default consumer version selectors used... πŸ˜…
πŸ‘ 1
m
I think it should tell you in the output notices what has been selected and why
j
yep, i saw the criteria why a pact was fetched in the logs. normally, i would see these two: β€’ consumer version(s) currently deployed to some-env-dev (some-commit-hash) and some-env-test (some-commit-hash) β€’ latest version of some-consumer from the main branch 'main' (some-commit-hash) which would mean the default consumer version selector has below
Copy code
{
  "consumerVersionSelectors": [
    {
      "mainBranch": true
    },
    {
      "deployedOrReleased": true
    }
  ]
}
however, sometimes i would see below too.
Copy code
latest version of some-consumer that has a pact with some-provider (some-commit-hash)
i don't know what setting that corresponds to. so i wanted to confirm what exactly are the default consumer version selectors since i can't rely on the logs to deduce it since i might miss a setting or two depending on the pacts stored in the broker πŸ˜…
πŸ‘ 1
m
The core maintainer is off sick at the moment, so you might need to wait a few days for a response i’m afraid!
j
if you could point me to a doc or code for the default consumer version selectors, that would be great. πŸ₯Ί oh no, hope he/she gets well quickly πŸ™
❀️ 1
m
Thanks. Unfortunately I can’t help you there myself!
πŸ˜… 1
πŸ‘ 1
t
I think the default is just the latest. But I wouldn't want to stake my reputation on that answer
j
hi Matt and Timothy! think i found my answer in the `pact-broker` code. thanks for your replies! πŸ˜…πŸ™ 1. if
branch
is set when publishing pacts, then criteria are: latest with
branch
= main, deployed, released 2. if
tag
(deprecated) is set instead of
branch
, then criteria are: latest with
tag
= main, deployed, released 3. if neither
branch
or
tag
is set, then criteria are: latest (overall), deployed, released
t
Awesome, thanks for tracking that down! If you have a moment to make a PR adding this info to the documentation, that would be extra great
πŸ˜₯ 1
j
sure, i can create a small PR for this Timothy! πŸ˜„πŸ‘
πŸ™Œ 1
πŸ™ 1
b
Thanks John. You tracked it down. Sorry, I’m a bit covidy at the moment.