Browse Source

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
pull/7239/head
Kit Patella 5 years ago committed by GitHub
parent
commit
9a220f3010
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      agent/consul/leader_test.go

10
agent/consul/leader_test.go

@ -982,15 +982,15 @@ func TestLeader_ChangeNodeID(t *testing.T) {
// Shut down a server, freeing up its address/port
s3.Shutdown()
// wait for s1.LANMembers() to show s3 as StatusFailed or StatusLeft on
retry.Run(t, func(r *retry.R) {
failed := 0
var gone bool
for _, m := range s1.LANMembers() {
if m.Status == serf.StatusFailed {
failed++
if m.Name == s3.config.NodeName && (m.Status == serf.StatusFailed || m.Status == serf.StatusLeft) {
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

Loading…
Cancel
Save