Retrieving published pacts from the broker using pact-jvm-provider-junit

344 views
Skip to first unread message

Andrew Fitzgerald

unread,
Jul 8, 2016, 3:47:01 PM7/8/16
to Pact
So I've been working on and off at getting a Pact POC up and running for our team, and I'm running into issues with the broker and pact-jvm-provider-junit.

I'm running my consumer tests and creating a pact file.

I'm then manually uploading the pact file to the pact-broker (fresh off of master)


curl -v -XPUT \-H "Content-Type: application/json" \
-d@spec/pacts/service_client_service.json \
http://your-pact-broker/pacts/provider/service/consumer/service-client/version/1.0.0

I'm then running my provider junit test and pointing it towards my broker, and it's saying it can't find any pacts for my provider.

@PactBroker(host = "localhost", port = "8080")

Upon debugging, I find that it's hitting http://localhost:8080/pacts/provider/service/latest, which is returning a 404.


Is there something I'm missing in the junit side, or am I tagging/publishing my pacts incorrectly, or is this unexpected behavior from the broker?

Thanks,
Andrew Fitzgerald

Ronald Holshausen

unread,
Jul 10, 2016, 7:18:21 PM7/10/16
to Andrew Fitzgerald, Pact
Hi Andrew,

Can you check the version of the pact broker you are running. I had a similar problem with testing recently, and it was because I was running an old version.


--
You received this message because you are subscribed to the Google Groups "Pact" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pact-support...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Ronald Holshausen

DiUS Computing Pty Ltd

Level 10, 99 Queens Street
Melbourne, VIC 3000

Phone: +61 3 9008 5400
Mobile: +61 413 162 439

http://www.diuscomputing.com.au

Andrew Fitzgerald

unread,
Jul 11, 2016, 9:14:13 AM7/11/16
to Pact, andrewcf...@gmail.com
I was running against a freshly cloned master, just tried it again with 1.9.3.
Same result.

Ronald Holshausen

unread,
Jul 11, 2016, 7:39:42 PM7/11/16
to Andrew Fitzgerald, Pact
Ok, how are you running it? Using a custom rack config or the one from the example project?

I'll try setup a similar project to see what the issue is.

Andrew Fitzgerald

unread,
Jul 12, 2016, 5:36:12 PM7/12/16
to Pact, andrewcf...@gmail.com
I've been following the directions for the example... unfortunately I've had issues getting bundle to work (fails installing nokogiri on OSX), so I've been using docker instead.

The docker file I've been using is pasted below

FROM ruby:2.1


RUN git clone https://github.com/bethesque/pact_broker.git && cd pact_broker && git checkout tags/v1.9.3 && cd example && bundle


WORKDIR "/pact_broker/example"


EXPOSE 8080


CMD bundle exec rackup -p 8080 --host 0.0.0.0

Ronald Holshausen

unread,
Jul 12, 2016, 9:22:53 PM7/12/16
to Andrew Fitzgerald, Pact
This is the same problem I had. 

Even though you are checking out the 1.9.3 tag, the Gemfile in the example directory has:
gem "pact_broker", "~>1.4"

which means it will only ever use the pack broker gem from 1.4.x series of versions. Change that to 
gem "pact_broker", "~>1.9.3"

I'll update the example to use the latest version.

Andrew Fitzgerald

unread,
Jul 12, 2016, 9:34:49 PM7/12/16
to Pact, andrewcf...@gmail.com
Yep, that did it...
Thanks for the help!
Reply all
Reply to author
Forward
0 new messages