<@U02JZ6Q89BN> I have opened a ticket with exact s...
# pact-broker
s
@Alan Boshier I have opened a ticket with exact same issue. Please take a look at https://pact-foundation.slack.com/archives/C9UN99H24/p1717400574261109. Waiting for JVM maintainer input.
a
Hi @s1apped my problem was more basic; it was to do with ensuring that the right consumer contracts were being verified in my tests, rather than whether the verification results were being published (which is not to rule out that also being an issue). In my scenario I had neglected to do a couple of rather critical things in my implementation: • Annotate my provider contract test with
AllowOverridePactUrl
• Specify both
pact.filter.pacturl
and
pact.filter.consumers
when running the tests Once I made those corrections, the expected verifications ran, and the verification results were published. P.S. I am using pact broker rather than pactflow.
s
Hmm I’m using pact broker as well. @Alan Boshier would you mind sharing properties that you are setting for verification task? I have above also set but for some reason I don’t see results In broker
a
These are the settings I'm passing to the verification test: pact.verifier.publishResults=true pact.filter.pacturl=<URL received from webhook> pact.filter.consumers=<consumer received from webhook> pact.provider.version=<version received from webhook> pactbroker.url=<set appropriately> pact.provider.tag=develop
s
are you using pact plugin and pactVerify task or normal tests with these properties? I’m setting exact same properties but I’m using branches instead of tags maybe there is some issue. Also are you on V4 ?
a
I'm using junit based tests with the requisite pact annotations, and not the pact maven plugin. This is all with pact v4.5.6 of JVM dependencies.
s
hmm I’m on 4.6.9. Have to check if it supports V4 and branches and will try to rollback and test again. Thanks for the info!
a
No problem - I'll try moving to a later v4 and see if it causes any problems. Let me know how it goes!
P.S. Uprev'd to pact dependencies 4.6.10 with no apparent problems
s
it’s confusing bumped provider to 4.6.10 setting below as sys properties and running test locally can verify they are falling for changed contract as expected
Copy code
'pact.provider.branch'        
'pactbroker.providerBranch'   
'pact.provider.version'       
'pact.verifier.publishResults'
'pact.filter.pacturl'         
'pact.filter.consumers'
but nothing is published.. I have even updated pact broker to latest
a
Maybe its worth dialing up the logging to max, if you havent already done so.
s
have everything in debug but don’t see anything obvious
a
Do you not see anything like this in the logs? (provider=foo, consumer=bar)
Copy code
2024-06-11 16:25:11.827  INFO [foo,,,] 1486 --- [           main] a.c.d.p.p.DefaultVerificationReporter    : Published verification result of 'Ok(interactionIds=[d5cc8d9fede4eb865d4afbcf13e9a649657b4754, ...])' for consumer 'Consumer(name=bar)'
s
so I was debugging and found interesting thing. Verification results are published only when all contracts are verified. For some reason Passed test is still marked as
unverifiedInteractions
so this condition will not be met. It happens for
V4 Asynchronous Message
Copy code
val unverifiedInteractions = unverifiedInteractions(pact, interactionResults)
return if (unverifiedInteractions.isEmpty()) {
  logger.debug {
    "All interactions for Pact ${pact.provider.name}-${pact.consumer.name} have a verification result"
  }
  val result = if (verificationReporter.publishingResultsDisabled(propertyResolver)) {
But have no idea why everything work for standard provider verification….
and here
unverifiedInteractions
still shows 3 interactions even though they were verified. Nothing to do with broker
a
It might not be relevant but all my pacts are essentially http/REST based, whereas it looks like yours are message-based. Could the tests be ending prematurely before all async interactions have been processed?
s
They are mixed async, rest and gRPC. I don’t think so since they are passing. When I run standard provider verification not webhook everything is published
a
Do those 2 triggers result in the same variables & values being passed to the tests? (and the same state change handlers being exercised)
s
I would say yes
a
Hmm I'm out of (possibly not) useful suggestions at this point I'm afraid; sounds like someone who knows the pact jvm codebase is needed to explain why those 3 interactions are still in the unverified collection, unless you can figure out via the debugger where in the code interactions are removed from that collection (which might provide further clues).
s
Look like I got it solved. And I was missing override url annotation on class which I was sure was extending class with annotation. This was causing 1 test using different contract url which was causing pact to calculate different calculateInteractionHash 🫠
a
Good news! I'm not sure why that annotation has to exist TBH; can't see under what circumstances you would want to switch off URL overriding.
s
yep wondered about the same thing. I guess there needs to be some reason 😉