diff --git a/agent/consul/leader_test.go b/agent/consul/leader_test.go index 23d281860..acc2062b9 100644 --- a/agent/consul/leader_test.go +++ b/agent/consul/leader_test.go @@ -987,9 +987,7 @@ func TestLeader_ChangeNodeID(t *testing.T) { failed++ } } - if got, want := failed, 1; got != want { - r.Fatalf("got %d failed members want %d", got, want) - } + require.Equal(r, 1, failed) }) // Bring up a new server with s3's name that will get a different ID @@ -1013,9 +1011,7 @@ func TestLeader_ChangeNodeID(t *testing.T) { retry.Run(t, func(r *retry.R) { for _, m := range s1.LANMembers() { - if m.Status != serf.StatusAlive { - r.Fatalf("bad status: %v", m) - } + require.Equal(r, serf.StatusAlive, m.Status) } }) } diff --git a/agent/consul/state/catalog.go b/agent/consul/state/catalog.go index 6d81ae097..96e4b7a05 100644 --- a/agent/consul/state/catalog.go +++ b/agent/consul/state/catalog.go @@ -376,6 +376,8 @@ func (s *Store) ensureNoNodeWithSimilarNameTxn(tx *memdb.Txn, node *structs.Node return fmt.Errorf("Cannot get status of node %s: %s", enode.Node, err) } + // Get the node health. If there's no Serf health check, we consider it safe to rename + // the node as it's likely an external node registration not managed by Consul. var nodeHealthy bool if enodeCheck != nil { enodeSerfCheck, ok := enodeCheck.(*structs.HealthCheck)