Closed DavidHvilava closed 2 years ago
Can you reproduce the scenario using this tool please https://github.com/pact-foundation/pact_broker/blob/master/ISSUES.md
You can copy the pacts-for-verification call with the WIP config from this file https://github.com/pact-foundation/pact_broker/blob/master/script/data/wip.rb
It's hard to say from looking at the code/logs provided, but at first glance it looks like you probably have some consumer version selectors defined which only match the main
branch and not the feature branches. The line:
.ConsumerVersionSelectors(pactBrokerProperties.ConsumerVersionSelectors)
is important, but without knowing what those selectors are it's impossible to say whether it's configured to retrieve anything other than the main
branch or not.
Hi Adam. This is a Consumer selector I have in a Provider test:
ConsumerVersionSelectors = new ConsumerVersionSelector[]
{
new ConsumerVersionSelector() { Consumer = "Consumer2", Branch = "refs/heads/main", Latest = true }
}
But according to documentation regarding 'Work in progress pacts' we don't have to explicitly specify Consumer feature branch. Pact should take care about that.
I didn't have time to try the tool that Beth suggested. Will try it this week
Sorry for delay. I specified 'MainBranch' setting in ConsumerVersionSelector:
ConsumerVersionSelectors = new ConsumerVersionSelector[]
{
new ConsumerVersionSelector() { Consumer = "Consumer2", MainBranch = true, Latest = true }
}
And it worked. Meaning that upon running a regular workflow for a Provider 'FeatureP1' branch that satisfies Consumer's expectations from 'main' and 'FeatureC1' branch a verification result is provided for both Consumer contracts.
I'm closing an issue. Thank you
Steps I did:
pre-condition a. PactNet v4.2.1, Pactflow Version: 6205800d4 b. There is a verified contract in 'main' branch
scenario a. Create a feature branch for Consumer with changed contract. Upon pushing it calls a webhook that triggers Provider's 'verify changed pact' workflow. Expected result of that step: contract fails verification against Providers 'main' branch. b. Create a feature branch for Provider with the changes required by Consumer. Upon pushing the regular Provider workflow is triggered.
Expected result: contracts for Consumer 'main' and 'FeatureC1' branches are fetched and successful verification is provided. Actual result: only contract for Consumer 'main' branch is fetched and successful verification is provided.
My code (the value of 'IncludeWipPactsSince' is hardcoded on purpose):
Pact Matrix from PactFlow shows that there were no validation of the pact from Consumer FeatureC1 branch when Provider regular workflow for FeatureP1 branch were run:
Excerpt from the Provider test log: