From 04d315b0a42b500718c7eb2922ebabab7a063808 Mon Sep 17 00:00:00 2001 From: Joachim Bauch Date: Mon, 7 Jun 2021 10:37:56 +0200 Subject: [PATCH] Wait for any messages to be processed before stopping Hub in tests. --- hub_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hub_test.go b/hub_test.go index ff44955..0a12df4 100644 --- a/hub_test.go +++ b/hub_test.go @@ -138,6 +138,8 @@ func CreateHubWithMultipleBackendsForTest(t *testing.T) (*Hub, NatsClient, *mux. } func WaitForHub(ctx context.Context, t *testing.T, h *Hub) { + // Wait for any channel messages to be processed. + time.Sleep(10 * time.Millisecond) h.Stop() for { h.mu.Lock()