mirror of
https://github.com/status-im/consul.git
synced 2025-02-02 17:03:31 +00:00
Test agent RPC client connection retries
This commit is contained in:
parent
f201b4b565
commit
31c9829751
@ -3,8 +3,6 @@ package agent
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/hashicorp/consul/testutil"
|
||||
"github.com/hashicorp/serf/serf"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
@ -14,6 +12,9 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/consul/testutil"
|
||||
"github.com/hashicorp/serf/serf"
|
||||
)
|
||||
|
||||
type rpcParts struct {
|
||||
@ -40,6 +41,9 @@ func testRPCClientWithConfig(t *testing.T, cb func(c *Config)) *rpcParts {
|
||||
lw := NewLogWriter(512)
|
||||
mult := io.MultiWriter(os.Stderr, lw)
|
||||
|
||||
configTry := 0
|
||||
RECONF:
|
||||
configTry += 1
|
||||
conf := nextConfig()
|
||||
cb(conf)
|
||||
|
||||
@ -50,6 +54,9 @@ func testRPCClientWithConfig(t *testing.T, cb func(c *Config)) *rpcParts {
|
||||
|
||||
l, err := net.Listen(rpcAddr.Network(), rpcAddr.String())
|
||||
if err != nil {
|
||||
if configTry < 3 {
|
||||
goto RECONF
|
||||
}
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user