mirror of
https://github.com/status-im/consul.git
synced 2025-02-16 23:57:07 +00:00
Retry http server connecting in agent/http_test
This commit is contained in:
parent
473908f636
commit
416c578f7a
@ -28,6 +28,9 @@ func makeHTTPServer(t *testing.T) (string, *HTTPServer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func makeHTTPServerWithConfig(t *testing.T, cb func(c *Config)) (string, *HTTPServer) {
|
func makeHTTPServerWithConfig(t *testing.T, cb func(c *Config)) (string, *HTTPServer) {
|
||||||
|
configTry := 0
|
||||||
|
RECONF:
|
||||||
|
configTry += 1
|
||||||
conf := nextConfig()
|
conf := nextConfig()
|
||||||
if cb != nil {
|
if cb != nil {
|
||||||
cb(conf)
|
cb(conf)
|
||||||
@ -36,6 +39,9 @@ func makeHTTPServerWithConfig(t *testing.T, cb func(c *Config)) (string, *HTTPSe
|
|||||||
dir, agent := makeAgent(t, conf)
|
dir, agent := makeAgent(t, conf)
|
||||||
servers, err := NewHTTPServers(agent, conf, agent.logOutput)
|
servers, err := NewHTTPServers(agent, conf, agent.logOutput)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if configTry < 3 {
|
||||||
|
goto RECONF
|
||||||
|
}
|
||||||
t.Fatalf("err: %v", err)
|
t.Fatalf("err: %v", err)
|
||||||
}
|
}
|
||||||
if len(servers) == 0 {
|
if len(servers) == 0 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user