diff --git a/relay/client/client_test.go b/relay/client/client_test.go index c98524748..a14b3f6d0 100644 --- a/relay/client/client_test.go +++ b/relay/client/client_test.go @@ -48,6 +48,9 @@ func TestClient(t *testing.T) { } }() + // wait for server to start + time.Sleep(300 * time.Millisecond) + t.Log("alice connecting to server") clientAlice := NewClient(ctx, serverURL, hmacTokenStore, "alice") err := clientAlice.Connect() @@ -114,6 +117,9 @@ func TestRegistration(t *testing.T) { } }() + // wait for server to start + time.Sleep(300 * time.Millisecond) + clientAlice := NewClient(ctx, serverURL, hmacTokenStore, "alice") err := clientAlice.Connect() if err != nil { @@ -186,6 +192,9 @@ func TestEcho(t *testing.T) { } }() + // wait for server to start + time.Sleep(300 * time.Millisecond) + clientAlice := NewClient(ctx, serverURL, hmacTokenStore, idAlice) err := clientAlice.Connect() if err != nil { @@ -267,6 +276,9 @@ func TestBindToUnavailabePeer(t *testing.T) { } }() + // wait for server to start + time.Sleep(300 * time.Millisecond) + clientAlice := NewClient(ctx, serverURL, hmacTokenStore, "alice") err := clientAlice.Connect() if err != nil { @@ -304,6 +316,9 @@ func TestBindReconnect(t *testing.T) { } }() + // wait for server to start + time.Sleep(300 * time.Millisecond) + clientAlice := NewClient(ctx, serverURL, hmacTokenStore, "alice") err := clientAlice.Connect() if err != nil { @@ -386,6 +401,9 @@ func TestCloseConn(t *testing.T) { } }() + // wait for server to start + time.Sleep(300 * time.Millisecond) + clientAlice := NewClient(ctx, serverURL, hmacTokenStore, "alice") err := clientAlice.Connect() if err != nil { @@ -433,6 +451,9 @@ func TestCloseRelayConn(t *testing.T) { } }() + // wait for server to start + time.Sleep(300 * time.Millisecond) + clientAlice := NewClient(ctx, serverURL, hmacTokenStore, "alice") err := clientAlice.Connect() if err != nil { @@ -469,6 +490,9 @@ func TestCloseByServer(t *testing.T) { } }() + // wait for server to start + time.Sleep(300 * time.Millisecond) + idAlice := "alice" log.Debugf("connect by alice") relayClient := NewClient(ctx, serverURL, hmacTokenStore, idAlice) @@ -512,6 +536,9 @@ func TestCloseByClient(t *testing.T) { } }() + // wait for server to start + time.Sleep(300 * time.Millisecond) + idAlice := "alice" log.Debugf("connect by alice") relayClient := NewClient(ctx, serverURL, hmacTokenStore, idAlice)