From d4d2f5ae5c5c86359fdf68b4deafe3f23e8dec86 Mon Sep 17 00:00:00 2001 From: Derek Collison Date: Sun, 22 May 2016 13:40:50 -0700 Subject: [PATCH 1/3] Fix flapper 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 d7b11998..93cbf11a 100644 --- a/server/monitor_test.go +++ b/server/monitor_test.go @@ -432,11 +432,9 @@ func TestConnzLastActivity(t *testing.T) { t.Fatalf("Un-subscribe should have triggered update to LastActivity\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) // Message delivery should trigger as well nc2.Publish("foo", []byte("Hello")) From 67479ea4cd8c5f26b2b726aeae1bd0f97f6608ea Mon Sep 17 00:00:00 2001 From: Derek Collison Date: Sun, 22 May 2016 13:50:02 -0700 Subject: [PATCH 2/3] remove runtime import --- server/monitor_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/server/monitor_test.go b/server/monitor_test.go index 93cbf11a..a9ea2a84 100644 --- a/server/monitor_test.go +++ b/server/monitor_test.go @@ -8,7 +8,6 @@ import ( "io/ioutil" "net/http" "net/url" - "runtime" "strings" "testing" "time" From a2d03fbf5a6042919c5ea41ea0ef4c78f8f94290 Mon Sep 17 00:00:00 2001 From: Derek Collison Date: Sun, 22 May 2016 15:04:47 -0700 Subject: [PATCH 3/3] flush immediately on creation --- server/monitor_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/monitor_test.go b/server/monitor_test.go index a9ea2a84..bb4053a0 100644 --- a/server/monitor_test.go +++ b/server/monitor_test.go @@ -357,9 +357,11 @@ func TestConnzLastActivity(t *testing.T) { nc := createClientConnSubscribeAndPublish(t) defer nc.Close() + nc.Flush() nc2 := createClientConnSubscribeAndPublish(t) defer nc2.Close() + nc2.Flush() pollConz := func() *Connz { url := fmt.Sprintf("http://localhost:%d/", MONITOR_PORT)