Skip to content

Commit

Permalink
Merge pull request #292 from ayuryshev/feature/remove-time-sleep-279
Browse files Browse the repository at this point in the history
Remove/justify time.Sleep in  internal/therealssh/client_test.go, pkg/messaging/client_test.go, pkg/app/app_test.go
  • Loading branch information
ayuryshev authored Apr 16, 2019
2 parents bf39234 + cd0a2af commit 63a80b0
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 10 deletions.
2 changes: 0 additions & 2 deletions internal/therealssh/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"encoding/binary"
"net"
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand All @@ -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)
Expand Down
1 change: 1 addition & 0 deletions pkg/app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func TestAppDial(t *testing.T) {
require.NotNil(t, app.conns[LoopAddr{2, Addr{rpk, 3}}])
require.NoError(t, conn.Close())

// Justified. Attempt to remove produces: FAIL
time.Sleep(100 * time.Millisecond)

addr := &LoopAddr{}
Expand Down
8 changes: 0 additions & 8 deletions pkg/messaging/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"os"
"sync"
"testing"
"time"

"github.com/skycoin/skycoin/src/util/logging"
"github.com/stretchr/testify/assert"
Expand All @@ -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))
Expand All @@ -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))

Expand Down Expand Up @@ -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))
}

Expand Down

0 comments on commit 63a80b0

Please sign in to comment.