From 156bf7b3813661ca58937912aea8569bacdd1d0b Mon Sep 17 00:00:00 2001 From: Ivan Kozlovic Date: Wed, 19 Feb 2020 16:52:41 -0700 Subject: [PATCH] Updates based on code review Signed-off-by: Ivan Kozlovic --- server/events_test.go | 2 +- server/server_test.go | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/server/events_test.go b/server/events_test.go index 3e2bee68..4f441192 100644 --- a/server/events_test.go +++ b/server/events_test.go @@ -816,7 +816,7 @@ func TestSystemAccountSystemConnectionLimitsHonored(t *testing.T) { // The account's connection count is exchanged between servers // so that the local count on each server reflects the total count. - // Pause a bit to give a change for each server to process the update. + // Pause a bit to give a chance to each server to process the update. time.Sleep(15 * time.Millisecond) } if tc != 10 { diff --git a/server/server_test.go b/server/server_test.go index c15f437c..a7bc6e91 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -707,14 +707,15 @@ func TestLameDuckMode(t *testing.T) { if n := len(cz.Conns); n != total { return fmt.Errorf("expected %v closed connections, got %v", total, n) } - for _, c := range cz.Conns { - if !strings.Contains(c.Reason, ServerShutdown.String()) { - return fmt.Errorf("expected closed connection with `%s` state, got `%s`", - ServerShutdown.String(), c.Reason) - } - } return nil }) + cz := pollConz(t, srvA, 1, "", &ConnzOptions{State: ConnClosed}) + if n := len(cz.Conns); n != total { + t.Fatalf("Expected %v closed connections, got %v", total, n) + } + for _, c := range cz.Conns { + checkReason(t, c.Reason, ServerShutdown) + } stopClientsAndSrvB(ncs)