Heera Singh
08/18/2022, 11:33 AMProvider verification (fetching contracts from pact broker)
I gets error message:
ERROR ThreadId(11) pact_verifier: Failed to load pact - Could not load pacts from the pact broker 'https://rain.pactflow.io' - ContentError("Request to pact broker URL 'https://rain.pactflow.io/pacts/provider/ATP_Provider/for-verification' failed - HTTP status client error (400 Bad Request) for url (https://rain.pactflow.io/pacts/provider/ATP_Provider/for-verification)")
To publish the contract I use command
"publish:pact": "pact-broker publish ./pacts --consumer-app-version 1.0.1 --auto-detect-version-properties --broker-base-url=https://**.<http://pactflow.io|pactflow.io> --broker-token=**"
I provide these options to Verifier
const opts = {
provider: "MY_Provider",
logLevel: process.env.LOG_LEVEL,
providerBaseUrl: process.env.BASE_URL,
stateHandlers: {
"when no auth passed": () => {
return Promise.resolve("no token needed");
},
},
pactBrokerUrl: process.env.PACT_BROKER_URL,
pactBrokerToken: process.env.PACT_BROKER_TOKEN,
publishVerificationResult: true,
consumerVersionSelectors: [
{
consumer: "10.0.1",
},
],
providerVersion: "1.0.0",
};
Any clue what I am doing wrong here.Yousaf Nabi (pactflow.io)
1.0.1 and using the consumerVersionSelector of 10.0.1 in your provider verification taskHeera Singh
08/18/2022, 11:47 AMYousaf Nabi (pactflow.io)
consumer key should have a value which matches the name of the consumer you are interested in. and you should have a key for version with 1.0.1
looking at https://docs.pact.io/pact_broker/advanced_topics/consumer_version_selectorsYousaf Nabi (pactflow.io)
Matt (pactflow.io / pact-js / pact-go)
Yousaf Nabi (pactflow.io)
branch , tag etcYousaf Nabi (pactflow.io)
Yousaf Nabi (pactflow.io)
you should have a key forThe docs don't actually show you can specify the consumer name with a version number, or thatwithversion1.0.1
version is a supported key in consumerVersionSelectorsTimothy Jones
08/18/2022, 2:26 PM--auto-detect-version-properties apply the branch?Yousaf Nabi (pactflow.io)
[--auto-detect-version-properties], [--no-auto-detect-version-properties]
# Automatically detect the repository branch from known CI
environment variables or git CLI. Supports Buildkite, Circle
CI, Travis CI, GitHub Actions, Jenkins, Hudson, AppVeyor,
GitLab, CodeShip, Bitbucket and Azure DevOps.
just checking in the code now, because I don't think it picks up a version, just branch, going by that description. could that be confusing.
Would --auto-detect-branch-properties be more appropriate, or for it to also include/infer a version property (say from a SHA), unless --consumer-app-version is explicitly stated.Yousaf Nabi (pactflow.io)
Timothy Jones
08/18/2022, 2:47 PMYousaf Nabi (pactflow.io)
Timothy Jones
08/18/2022, 10:30 PMHeera Singh
08/19/2022, 3:37 AMNo value provided for required options '--consumer-app-version',Heera Singh
08/19/2022, 3:41 AMpact-broker publish ./pacts --consumer-app-version 1.0.1 --branch branch1 --broker-base-url=https://**.<http://pactflow.io|pactflow.io> --broker-token=** and in provider test consumerVersionSelectors: [
{ consumer: "Order_Consumer", branch: "branch1" },
],Heera Singh
08/19/2022, 3:41 AM