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

Verify from Pact Broker fails with no useful information #98

Open
adam-pike-dunelm opened this issue Aug 10, 2018 · 9 comments
Open

Verify from Pact Broker fails with no useful information #98

adam-pike-dunelm opened this issue Aug 10, 2018 · 9 comments

Comments

@adam-pike-dunelm
Copy link

adam-pike-dunelm commented Aug 10, 2018

Description:

I want to verify my provider against a pact on a remotely hosted Pact Broker (the Beta version provided by Pact). But I get a Failed to load consumer pact from: <url> message.

There's nothing to help me understand why either in the consol or the logs. The Verification works fine against a local pact file.

Steps:

Added the following to my build.sbt

pactBrokerAddress := "https://my-pact-broker:4321"
providerName := "The Name Of This Service"
consumerNames := Seq("Consumer A")

Have checked that all of my values are correct on the above and even tried adding it to a pact.sbt but got the same result.

Ran the following:

sbt "pact-verify --host localhost --port <port-number-of-running-service>"

Expectation:

If all is well a test result.
If all is not well, a useful error message that points to why it failed

Actual:

Attempting to fetch pact from pact broker at: https://<url>/latest
[http4s-blaze-client-5] INFO org.http4s.client.PoolManager - Shutting down connection pool: allocated=1 idleQueue.size=1 waitQueue.size=0
Failed to load consumer pact from: https://<url>/latest
Verifying against 'localhost' on port '9000' with a timeout of <unspecified> second(s).

Sorry if I have missed anything obvious, but I didn't really know where to start with debugging this.

@adam-pike-dunelm adam-pike-dunelm changed the title Verify from Pact Broker with no useful information Verify from Pact Broker fails with no useful information Aug 10, 2018
@adam-pike-dunelm
Copy link
Author

FYI: I can pull down the pact file via a Postman GET

@davesmith00000
Copy link
Contributor

davesmith00000 commented Aug 10, 2018

Can I just check: your examples above reference http and https, is that just an oversight as you wrote up the issue?

@adam-pike-dunelm
Copy link
Author

Correct - I have the whole lot as https. I copied the first snippet from from the pact documentation, will edit.

@adam-pike-dunelm
Copy link
Author

Actually, I've just realised - where I have successfully download via Postman, I had read access username and password basic auth. Are there any options for this on the scala-pact CLI?

@davesmith00000
Copy link
Contributor

Try this:

it("should accept ok addresses that have basic authentication") {

@adam-pike-dunelm
Copy link
Author

OK I gave that a go and I get the same result. I copied the url from the console output and compared it with what I have in postman and they're exactly the same.

Just for thoroughness I tried switching to our guest wifi and I now get a different error:

Error: Client request timeout after 2 seconds.

So I suspect the first fail was something to do with the corp network - although it allowed postman requests weirdly.

Is there a way I can extend the default timeout of 2 seconds?

@davesmith00000
Copy link
Contributor

Yes, sounds like we might be making some progress. You're literally the second person to report this problem and the first guy also submitted the PR with the test case I pointed you to. :-)

Try this:
sbt "pact-verify --host --port --clientTimeout 10"

There is, unfortunately, this issue which I discovered yesterday:
#99

That issuse shouldn't be the problem however, just a symptom of something else, 2 seconds to Scala-Pact might as well be two minutes. Assuming you're contract file isn't gigantic and you're network isn't really really poor, then a client timeout usually means that the details to your pact broker or to your running service are incorrect.

Something to try!

Use Postman or Curl to download the Pact file, and then do this to run the verification from a local source:
sbt "pact-verify --host --port --source "

If that works, then it's definitely something to do with your ability to connect to pact broker, if it doesn't work then the problem (or one of the problems) is that you're not setup to hit your service properly.

Let me know how you get on!

@adam-pike-dunelm
Copy link
Author

Thanks Dave,

Using the --clientTimeout does prevent my timeouts so I just have rubbish internets here. But I'm back to the original error being shown constantly. I can run against the downloaded file as a local source no problem and I really can't see what is wrong with my pact setup for downloading - the documented setup is really simple and I've double checked everything is right.

I'm not going to burn more time on it for now as there's a simple solution - I download from Pact Broker to a local directory with another client as a pre-step to running pact.

@davesmith00000
Copy link
Contributor

Hmmm.. I'll also take an action to look into this more carefully. I was satisfied that the committer had done the right thing the first time around (given that he'd fixed his own problem!) but I'll give it some more attention when I get a few minutes and see if I can replicate it at least.

Glad to hear you have a work around for now though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants