agent/consul server: fix LeaderTest_ChangeNodeID (#7236)
* fix LeaderTest_ChangeNodeID to use StatusLeft and add waitForAnyLANLeave * unextract the waitFor... fn, simplify, and provide a more descriptive error
This commit is contained in:
parent
cabc189b50
commit
aa9db3f903
|
@ -982,15 +982,15 @@ func TestLeader_ChangeNodeID(t *testing.T) {
|
||||||
|
|
||||||
// Shut down a server, freeing up its address/port
|
// Shut down a server, freeing up its address/port
|
||||||
s3.Shutdown()
|
s3.Shutdown()
|
||||||
|
// wait for s1.LANMembers() to show s3 as StatusFailed or StatusLeft on
|
||||||
retry.Run(t, func(r *retry.R) {
|
retry.Run(t, func(r *retry.R) {
|
||||||
failed := 0
|
var gone bool
|
||||||
for _, m := range s1.LANMembers() {
|
for _, m := range s1.LANMembers() {
|
||||||
if m.Status == serf.StatusFailed {
|
if m.Name == s3.config.NodeName && (m.Status == serf.StatusFailed || m.Status == serf.StatusLeft) {
|
||||||
failed++
|
gone = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
require.Equal(r, 1, failed)
|
require.True(r, gone, "s3 has not been detected as failed or left after shutdown")
|
||||||
})
|
})
|
||||||
|
|
||||||
// Bring up a new server with s3's name that will get a different ID
|
// Bring up a new server with s3's name that will get a different ID
|
||||||
|
|
Loading…
Reference in New Issue