From 2c25cf426d933d096a5a1a65945bb6a0f6740135 Mon Sep 17 00:00:00 2001 From: gfanton <8671905+gfanton@users.noreply.github.com> Date: Tue, 8 Nov 2022 19:05:27 +0100 Subject: [PATCH] fix: test data race Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com> --- client_test.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/client_test.go b/client_test.go index 7a45d2d..24ccc5a 100644 --- a/client_test.go +++ b/client_test.go @@ -93,6 +93,8 @@ func TestClientRegistrationAndDiscovery(t *testing.T) { } func TestClientRegistrationAndDiscoveryAsync(t *testing.T) { + DiscoverAsyncInterval = 1 * time.Second + ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -109,8 +111,6 @@ func TestClientRegistrationAndDiscoveryAsync(t *testing.T) { clients := getRendezvousClients(t, hosts) - DiscoverAsyncInterval = 1 * time.Second - ch, err := clients[0].DiscoverAsync(ctx, "foo1") if err != nil { t.Fatal(err) @@ -128,6 +128,4 @@ func TestClientRegistrationAndDiscoveryAsync(t *testing.T) { pi := <-ch checkPeerInfo(t, pi, hosts[1+i]) } - - DiscoverAsyncInterval = 2 * time.Minute }