-
-
Notifications
You must be signed in to change notification settings - Fork 481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provider verification succeeds only for the first tag of a consumer #1086
Labels
bug
Indicates an unexpected problem or unintended behavior
Comments
pkuras
changed the title
Verification result is published only for the first tag of a consumer
Provider verification succeeds only for the first tag of a consumer
May 7, 2020
Ah, right! It uses the contents of the Pact to determine when results are not complete, but not the tags. Yes, the tag should also be included! |
Unfortunately, I'm now affected by the linked issue #1113. Tests are now run only for the first tag of consumer. |
Tested with version 4.1.4 and the issue has been resolved. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have Pact provider verification tests which is verifying two tags of each consumer from the Pact Broker:
@PactBroker( host = "...", port = ".", tags = "master,prod" )
The test execution goes fine: for each interaction, there are two tests run (one for the
master
tag, the other for theprod
tag).As expected, the penultimate state test prints that there's 1 more interaction to verify for both the tags (it's a pity the tag names are not printed, but it's a different issue).
Things get interesting on the last test. The first pact with the first tag gets their pacts verified (result is not published because I'm running tests locally), but the the pact with the second tag gets its verified interactions count reset and the pact is not verified.
I dug into the code a bit and it seems the problem is that
DefaultTestResultAccumulator
uses hash of a Pact to store interaction results. The hash is calculated using only consumer and provider name:This means that differently tagged pacts of the same consumer have the same hash. Then, once one pact is fully verified, pact hash is removed from the
testResults
map: https://github.com/DiUS/pact-jvm/blob/master/provider/pact-jvm-provider/src/main/kotlin/au/com/dius/pact/provider/TestResultAccumulator.kt#L60It seems like a solution could be to change the
calculatePactHash
to also take into account tag or consumer version.The text was updated successfully, but these errors were encountered: