Wait for any messages to be processed before stopping Hub in tests.

This commit is contained in:
Joachim Bauch 2021-06-07 10:37:56 +02:00
parent 3f19882612
commit 04d315b0a4
No known key found for this signature in database
GPG key ID: 77C1D22D53E15F02

View file

@ -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()