mirror of https://github.com/status-im/consul.git
command: Fixing more tests
This commit is contained in:
parent
657da8eaf6
commit
6fd3f81c48
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue