Skip to content
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

Fetching pacts from broker for an unknown provider should fail gracefully #1331

Closed
anchit-h opened this issue Mar 25, 2021 · 1 comment
Closed
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@anchit-h
Copy link

When trying out the steps given in the pact-workshop ( https://github.com/DiUS/pact-workshop-jvm ) , step 13 is bound to fail.

Once we bring up the docker image for a local broker at localhost:9292 a catch 22 situation occurs where the default step13 code expects the broker to contain some pacts. Since it's a new broker with no existing pacts the gradle build fails. That failure prevents us from adding new pacts. In other words, the build fails because it needs existing pacts in the broker. However, in order to add those pacts for the first time, the build must pass.

One way to solve this is to comment out the last 3 lines in providers/springboot-provider/build.gradle where a check is made to the broker to find out whether there are any existing pacts.

Adding the code here in case it helps anyone else stuck with the same problem on step#13.

Inside providers/springboot-provider/build.gradle file, commenting out the following line helps prevent build failure for step13

// Workaround for 'the gradle build failing if no pacts exist on the broker'
//      if (project.hasProperty('pactBrokerUser') && pactBrokerUser != '<YOUR USER>') {
//        hasPactsFromPactBroker(pactBrokerUrl, authentication: ['Basic', pactBrokerUser, pactBrokerPassword])
//      }

The code in step 13 should be modified so that the gradle build doesn't fail if no pacts exist in the local broker.

@uglyog uglyog added the bug Indicates an unexpected problem or unintended behavior label Mar 27, 2021
uglyog pushed a commit that referenced this issue Mar 28, 2021
@mefellows
Copy link
Member

Ron's updated this with a change to the Gradle plugin that prevents this issue. Thanks for raising this Anchit!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

3 participants