consul: fix server left test
This commit is contained in:
parent
084643abee
commit
f3fad2180c
|
@ -310,23 +310,24 @@ func TestLeader_LeftServer(t *testing.T) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Kill any server
|
testutil.WaitForResult(func() (bool, error) {
|
||||||
servers[0].Shutdown()
|
// Kill any server
|
||||||
time.Sleep(100 * time.Millisecond)
|
servers[0].Shutdown()
|
||||||
|
|
||||||
// Force remove the non-leader (transition to left state)
|
// Force remove the non-leader (transition to left state)
|
||||||
if err := servers[1].RemoveFailedNode(servers[0].config.NodeName); err != nil {
|
if err := servers[1].RemoveFailedNode(servers[0].config.NodeName); err != nil {
|
||||||
t.Fatalf("err: %v", err)
|
t.Fatalf("err: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range servers[1:] {
|
for _, s := range servers[1:] {
|
||||||
testutil.WaitForResult(func() (bool, error) {
|
|
||||||
peers, _ := s.raftPeers.Peers()
|
peers, _ := s.raftPeers.Peers()
|
||||||
return len(peers) == 2, errors.New(fmt.Sprintf("%v", peers))
|
return len(peers) == 2, errors.New(fmt.Sprintf("%v", peers))
|
||||||
}, func(err error) {
|
}
|
||||||
t.Fatalf("should have 2 peers: %v", err)
|
|
||||||
})
|
return true, nil
|
||||||
}
|
}, func(err error) {
|
||||||
|
t.Fatalf("err: %s", err)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLeader_LeftLeader(t *testing.T) {
|
func TestLeader_LeftLeader(t *testing.T) {
|
||||||
|
|
Loading…
Reference in a new issue