Pact-Go cannot find the server is running

185 views Asked by At

I'm trying to create a simple consumer-provider contract with Pact and Pact Broker.

The consumer is working and it's publishing the interactions to the broker as expected, but the provider is failing to when running the tests.

The error is:

--- FAIL: TestPact (10.14s)
    pact.go:270: Error: Expected server to start < 10s. Timed out waiting for Daemon on port 0 - are you
                sure it's running?

Here is the repo with the provider https://github.com/tutabeier/pact-consumer-provider/tree/master/provider

Most specifically, here is the test: https://github.com/tutabeier/pact-consumer-provider/blob/master/provider/cmd/provider/main_test.go

I have no idea what I'm doing wrong.

1

There are 1 answers

0
kostix On

«on port 0» — this is flat out weird: no service is ever listening on port 0, but this number is commonly used to bind a service to a port, and in this case it means the OS is asked to pick any free port and assign it to that service. One then is expected to ask the bound socket to tell it what port it ended up listening on.

Still, the code in main_test.go uses hard-coded port numbers, and neither of them is 0.

So I have no idea but at least tried to keep your efforts going.