diff --git a/command/force_leave_test.go b/command/force_leave_test.go index f98757bbc3..6b66b4fb1c 100644 --- a/command/force_leave_test.go +++ b/command/force_leave_test.go @@ -20,7 +20,7 @@ func TestForceLeaveCommandRun(t *testing.T) { defer a1.Shutdown() defer a2.Shutdown() - addr := fmt.Sprintf("127.0.0.1:%d", a2.config.SerfLanPort) + addr := fmt.Sprintf("127.0.0.1:%d", a2.config.Ports.SerfLan) _, err := a1.agent.JoinLAN([]string{addr}) if err != nil { t.Fatalf("err: %s", err) diff --git a/command/join_test.go b/command/join_test.go index d712377854..bbbf2023ac 100644 --- a/command/join_test.go +++ b/command/join_test.go @@ -21,7 +21,7 @@ func TestJoinCommandRun(t *testing.T) { c := &JoinCommand{Ui: ui} args := []string{ "-rpc-addr=" + a1.addr, - fmt.Sprintf("127.0.0.1:%d", a2.config.SerfLanPort), + fmt.Sprintf("127.0.0.1:%d", a2.config.Ports.SerfLan), } code := c.Run(args) @@ -45,7 +45,7 @@ func TestJoinCommandRun_wan(t *testing.T) { args := []string{ "-rpc-addr=" + a1.addr, "-wan", - fmt.Sprintf("127.0.0.1:%d", a2.config.SerfWanPort), + fmt.Sprintf("127.0.0.1:%d", a2.config.Ports.SerfWan), } code := c.Run(args) diff --git a/command/members_test.go b/command/members_test.go index 420753f982..47a27ffb99 100644 --- a/command/members_test.go +++ b/command/members_test.go @@ -42,7 +42,7 @@ func TestMembersCommandRun_WAN(t *testing.T) { t.Fatalf("bad: %d. %#v", code, ui.ErrorWriter.String()) } - if !strings.Contains(ui.OutputWriter.String(), fmt.Sprintf("%d", a1.config.SerfWanPort)) { + if !strings.Contains(ui.OutputWriter.String(), fmt.Sprintf("%d", a1.config.Ports.SerfWan)) { t.Fatalf("bad: %#v", ui.OutputWriter.String()) } } diff --git a/command/util_test.go b/command/util_test.go index 582a021933..8c73196213 100644 --- a/command/util_test.go +++ b/command/util_test.go @@ -69,19 +69,20 @@ func testAgent(t *testing.T) *agentWrapper { } func nextConfig() *agent.Config { - idx := atomic.AddUint64(&offset, 1) + idx := int(atomic.AddUint64(&offset, 1)) conf := agent.DefaultConfig() conf.Bootstrap = true conf.Datacenter = "dc1" conf.NodeName = fmt.Sprintf("Node %d", idx) - conf.HTTPAddr = fmt.Sprintf("127.0.0.1:%d", 10000+10*idx) - conf.RPCAddr = fmt.Sprintf("127.0.0.1:%d", 10100+10*idx) - conf.SerfBindAddr = "127.0.0.1" - conf.SerfLanPort = int(10201 + 10*idx) - conf.SerfWanPort = int(10202 + 10*idx) + conf.BindAddr = "127.0.0.1" conf.Server = true - conf.ServerAddr = fmt.Sprintf("127.0.0.1:%d", 10300+10*idx) + + conf.Ports.HTTP = 10000 + 10*idx + conf.Ports.RPC = 10100 + 10*idx + conf.Ports.SerfLan = 10201 + 10*idx + conf.Ports.SerfWan = 10202 + 10*idx + conf.Ports.Server = 10300 + 10*idx cons := consul.DefaultConfig() conf.ConsulConfig = cons