fix typo and add one more test scenario

This commit is contained in:
Preetha Appan
2019-05-08 10:54:22 -05:00
parent 12e1804733
commit 5bfa35ab81
2 changed files with 6 additions and 1 deletions

View File

@@ -204,7 +204,7 @@ func (m *Manager) SetServers(servers Servers) bool {
// Determine if they are equal
equal := m.serversAreEqual(servers)
// If server list is equal don't change the list and return immediatly
// If server list is equal don't change the list and return immediately
// This prevents unnecessary shuffling of a failed server that was moved to the
// bottom of the list
if equal {

View File

@@ -74,6 +74,11 @@ func TestServers_SetServers(t *testing.T) {
require.False(m.SetServers([]*servers.Server{s1, s2}))
after := m.GetServers()
require.Equal(before, after)
// Send a shuffled list, verify original order doesn't change
require.False(m.SetServers([]*servers.Server{s2, s1}))
afterShuffledInput := m.GetServers()
require.Equal(after, afterShuffledInput)
}
func TestServers_FindServer(t *testing.T) {