From ec0fa23d2ff3ad032505c0b7ca9fa51875c32582 Mon Sep 17 00:00:00 2001 From: Alex Yu Date: Tue, 16 Apr 2019 08:03:45 +0300 Subject: [PATCH] Changes: 1. internal/therealssh/client_test.go: removed unnecessary time.Sleep in TestClientOpenChannel 2. pkg/messaging/client_test.go: removed unnecessary time.Sleep in TestClientDial Tested: ```sh $ loop -n 100 "go clean -testcache &>/dev/null || go test -race -cover -timeout=1m ./internal/therealssh -run TestClientOpenChannel" $ loop -n 100 "go clean -testcache &>/dev/null || go test -race -cover -timeout=1m ./pkg/messaging -run TestClientDial" ``` --- internal/therealssh/client_test.go | 2 -- pkg/messaging/client_test.go | 8 -------- 2 files changed, 10 deletions(-) diff --git a/internal/therealssh/client_test.go b/internal/therealssh/client_test.go index bf450d4f50..a4f4fcbfde 100644 --- a/internal/therealssh/client_test.go +++ b/internal/therealssh/client_test.go @@ -4,7 +4,6 @@ import ( "encoding/binary" "net" "testing" - "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -29,7 +28,6 @@ func TestClientOpenChannel(t *testing.T) { resCh <- data{ch, err} }() - time.Sleep(100 * time.Millisecond) buf := make([]byte, 5) _, err := conn.Read(buf) require.NoError(t, err) diff --git a/pkg/messaging/client_test.go b/pkg/messaging/client_test.go index 660304139e..8b64725897 100644 --- a/pkg/messaging/client_test.go +++ b/pkg/messaging/client_test.go @@ -7,7 +7,6 @@ import ( "os" "sync" "testing" - "time" "github.com/skycoin/skycoin/src/util/logging" "github.com/stretchr/testify/assert" @@ -34,8 +33,6 @@ func TestClientDial(t *testing.T) { require.NoError(t, err) srvPK := srv.config.Public - time.Sleep(100 * time.Millisecond) - anotherPK, anotherSK := cipher.GenerateKeyPair() anotherClient := NewClient(&Config{anotherPK, anotherSK, discovery, 0, 0}) require.NoError(t, anotherClient.ConnectToInitialServers(context.TODO(), 1)) @@ -56,8 +53,6 @@ func TestClientDial(t *testing.T) { errCh <- err }() - time.Sleep(100 * time.Millisecond) - require.NoError(t, <-errCh) require.NotNil(t, c.getLink(srvPK).chans.get(0)) @@ -87,9 +82,6 @@ func TestClientDial(t *testing.T) { require.NoError(t, tr.Close()) require.NoError(t, anotherTr.Close()) - time.Sleep(100 * time.Millisecond) - - // require.Nil(t, c.getLink(srvPK).chans.get(0)) require.Nil(t, anotherClient.getLink(srvPK).chans.get(0)) }