pact-foundation / pact-jvm

JVM version of Pact. Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project.
https://docs.pact.io
Apache License 2.0
1.08k stars 479 forks source link

Incorrect error message for canIDeploy failed gradle task #1393

Open AliaksandrValadzko opened 3 years ago

AliaksandrValadzko commented 3 years ago

Steps to reproduce:

  1. create interaction between serviceA and serviceB;
  2. create failed verification of contract between serviceA and serviceB;
  3. create interaction between serviceC and serviceD;
  4. create failed verification of contract between serviceC and serviceD;
  5. run canIDeploy for serviceA and serviceB
    canIDeploy
    -Ppacticipant=serviceA
    -PpacticipantVersion=versionA
    -Ppacticipant=serviceB
    -PpacticipantVersion=versionB

    Expected resut:

    
    Computer says no ?\_(?)_/? 

There is no verified pact between the latest version of serviceA (versionA) and version versionB of serviceB


**Actual result:**

Computer says no ?_(?)_/?

There is no verified pact between the latest version of serviceC (versionC) and version versionD of serviceD



**Issue**
`pacticipant `and `pacticipantVersion `parameters are ignored in error message for failed `canIDeploy `task

_Note:_
for verified interaction we still receive valid output, no issue here
`Computer says yes \o/ `
uglyog commented 3 years ago

I am unable to replicate this. Can you provide the versions of Pact-JVM, Gradle and the Pact broker you are using?

I have setup the broker as per your example: image image image

And when I run canIDeploy:

$ ./gradlew canIDeploy -Ppacticipant=serviceA -PpacticipantVersion=versionA -Ppacticipant=serviceB -PpacticipantVersion=versionB

> Configure project :

The 'org.jetbrains.kotlin.platform.*' plugins are deprecated and will no longer be available in Kotlin 1.4.
Please migrate the project to the 'org.jetbrains.kotlin.multiplatform' plugin.
See: https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html

> Task :canIDeploy FAILED
Computer says no ¯\_(ツ)_/¯ 

WARN: For production use of can-i-deploy, it is recommended to specify the environment into which you are deploying. Without the environment, this result will not be reliable.
The verification for the pact between the latest version of serviceA (versionA) and version versionB of serviceB failed

FAILURE: Build failed with an exception.

* What went wrong:
Can you deploy? Computer says no ¯\_(ツ)_/¯ 

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s
uglyog commented 3 years ago

BTW, the canIDeploy task does not take multiple values for pacticipant and pacticipantVersion, I assume they just overwrite each other, so it is effectively just running ./gradlew canIDeploy -Ppacticipant=serviceB -PpacticipantVersion=versionB