What tells pact verifier to fetch pacts from a par...
# pact-broker
s
What tells pact verifier to fetch pacts from a particular consumer? So far we've had one consumer and one provider. Call them "consumer-service" and "provider-service". As an experiment, I re-published consumer under a different name "consumer-service-a". I ran provider verification with the following options:
Copy code
%{
  branch: <provider-branch>,
  host: "localhost",
  name: <provider-service>,
  pact_source_opts: %{
    broker_password: <password>,
    broker_username: <username>,
    broker_url: <broker-root-url>,
    consumer_version_selectors: "[{\"mainBranch\":true}]",
    enable_pending: 1
  },
  port: "1234",
  skip_publish: 0,
  state_change_url: "<http://localhost:1234/state_change>",
  version: <provider-version-sha>
}
... and it fetched latest pact from "consumer-service", even though nowhere in the code I mention anything about the consumer name. Should I? Did I miss something? If we add a legit second consumer in the future, how do I specify it?
✅ 1
> If we add a legit second consumer in the future, how do I specify it? I assume I can use
consumer
property in consumer version selectors? 🤔 https://docs.pact.io/pact_broker/advanced_topics/consumer_version_selectors#properties Still the question remains, how did it decide to use
"consumer-service"
in my experiment? Some internal logic picks a random one? Should it?
🦆
I assume I can use
consumer
property in consumer version selectors?
Yup, just verified that
y
the consumer version selectors be sent to the broker for it to determine which pacts to return here it should be the latest pact on the mainBranch for any consumer who relies on your provider service if both consumers specify that provider, and they both have a mainBranch specified it should pick them. the output should state why a pact was selected
s
Ah okay, interesting. So previously I did not have master branch on the second consumer, that's why it verified only the first one. Now that I specified master branch on the second one as well, it actually ran verifications for both. Okay great, all works nicely! 👍