From bb81a37cdc1a3f0bd87241722c6fc584d71f3005 Mon Sep 17 00:00:00 2001 From: Ivan Kozlovic Date: Tue, 26 Apr 2016 18:14:01 -0600 Subject: [PATCH] Fix flapping test Introduce sleep when checking activity updates. I had fixed it originally for Windows and then made it for all platform recently but only for the publish case. I missed the subscribe test. --- server/monitor_test.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/server/monitor_test.go b/server/monitor_test.go index c70cdd08..52f2f87c 100644 --- a/server/monitor_test.go +++ b/server/monitor_test.go @@ -389,11 +389,9 @@ func TestConnzLastActivity(t *testing.T) { t.Fatalf("Expected LastActivity to be valid\n") } - // On Windows, looks like the precision is too low, and if we - // don't wait, first and last would be equal. - if runtime.GOOS == "windows" { - time.Sleep(100 * time.Millisecond) - } + // Just wait a bit to make sure that there is a difference + // between first and last. + time.Sleep(100 * time.Millisecond) // Sub should trigger update. nc.Subscribe("hello.world", func(m *nats.Msg) {})