Skip to content

Commit

Permalink
Changes:
Browse files Browse the repository at this point in the history
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"
```
  • Loading branch information
ayuryshev committed Apr 16, 2019
1 parent 1bdeee2 commit ec0fa23
Show file tree
Hide file tree
Showing 2 changed files with 0 additions 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
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 ec0fa23

Please sign in to comment.