Add sleep time after server started

This commit is contained in:
Zoltan Papp 2024-07-08 22:13:31 +02:00
parent dab50f35d7
commit e4ec1fd757

View File

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