Skip to content

Commit

Permalink
Increase websocket test coverage
Browse files Browse the repository at this point in the history
Signed-off-by: Lorenzo Donini <lorenzo.donini90@gmail.com>
  • Loading branch information
lorenzodonini committed May 2, 2021
1 parent 7a1f9e8 commit 2c8eaf1
Show file tree
Hide file tree
Showing 2 changed files with 159 additions and 37 deletions.
10 changes: 5 additions & 5 deletions ws/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ func (s *NetworkTestSuite) TearDownSuite() {
}

func (s *NetworkTestSuite) SetupTest() {
s.server = NewWebsocketServer(s.T(), nil)
s.client = NewWebsocketClient(s.T(), nil)
s.server = newWebsocketServer(s.T(), nil)
s.client = newWebsocketClient(s.T(), nil)
}

func (s *NetworkTestSuite) TearDownTest() {
Expand All @@ -55,7 +55,7 @@ func (s *NetworkTestSuite) TearDownTest() {

func (s *NetworkTestSuite) TestClientConnectionFailed() {
t := s.T()
s.server = NewWebsocketServer(t, nil)
s.server = newWebsocketServer(t, nil)
s.server.SetNewClientHandler(func(ws Channel) {
assert.Fail(t, "should not accept new clients")
})
Expand Down Expand Up @@ -88,7 +88,7 @@ func (s *NetworkTestSuite) TestClientConnectionFailedTimeout() {
// Set timeouts for test
s.client.timeoutConfig.HandshakeTimeout = 2 * time.Second
// Setup
s.server = NewWebsocketServer(t, nil)
s.server = newWebsocketServer(t, nil)
s.server.SetNewClientHandler(func(ws Channel) {
assert.Fail(t, "should not accept new clients")
})
Expand Down Expand Up @@ -125,7 +125,7 @@ func (s *NetworkTestSuite) TestClientAutoReconnect() {
serverOnDisconnected := make(chan bool, 1)
clientOnDisconnected := make(chan bool, 1)
reconnected := make(chan bool, 1)
s.server = NewWebsocketServer(t, nil)
s.server = newWebsocketServer(t, nil)
s.server.SetNewClientHandler(func(ws Channel) {
assert.NotNil(t, ws)
conn := s.server.connections[ws.GetID()]
Expand Down
Loading

0 comments on commit 2c8eaf1

Please sign in to comment.