fix: test data race

Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
This commit is contained in:
gfanton 2022-11-08 19:05:27 +01:00
parent 9135bf5c15
commit 2c25cf426d

View File

@ -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
}