mirror of
https://github.com/status-im/consul.git
synced 2025-01-22 11:40:06 +00:00
porter: add better warning if missing
This commit is contained in:
parent
9dec64dd17
commit
86901b887d
@ -6,6 +6,7 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
var DefaultAddr = "127.0.0.1:7965"
|
var DefaultAddr = "127.0.0.1:7965"
|
||||||
@ -23,6 +24,9 @@ func RandomPorts(n int) ([]int, error) {
|
|||||||
}
|
}
|
||||||
resp, err := http.Get(fmt.Sprintf("http://%s/%d", addr, n))
|
resp, err := http.Get(fmt.Sprintf("http://%s/%d", addr, n))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if strings.Contains(err.Error(), "connection refused") {
|
||||||
|
return nil, fmt.Errorf("Are you running porter?\nInstall with 'go install github.com/hashicorp/consul/test/porter/cmd/porter'\nThen run 'porter go test ...'\n%s", err)
|
||||||
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user