diff --git a/.golangci.yml b/.golangci.yml index 53f3833d1..53281cc09 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -52,6 +52,7 @@ issues: exclude-use-default: false exclude: - "^.*SA1019.*$" # Excluding SA1019 errors + - "^.*G115.*$" # Excluding G115 errors exclude-files: - da/celestia/mock/server.go - ./*_test.go # TODO: bring back diff --git a/rpc/json/ws_test.go b/rpc/json/ws_test.go index 78a028cb8..3a0acd7de 100644 --- a/rpc/json/ws_test.go +++ b/rpc/json/ws_test.go @@ -116,6 +116,7 @@ func TestWebsocketCloseUnsubscribe(t *testing.T) { srv := httptest.NewServer(handler) conn, resp, err := websocket.DefaultDialer.Dial(strings.Replace(srv.URL, "http://", "ws://", 1)+"/websocket", nil) + require.NoError(err) require.NotNil(resp) require.NotNil(conn) @@ -140,8 +141,15 @@ func TestWebsocketCloseUnsubscribe(t *testing.T) { // disconnect websocket err = conn.WriteControl(websocket.CloseMessage, websocket.FormatCloseMessage(websocket.CloseNormalClosure, ""), time.Now().Add(time.Second)) assert.NoError(err) + + // Wait for close to complete + <-time.After(100 * time.Millisecond) + // Validate we have one less client assert.Eventually(func() bool { return subscribed_clients == local.EventBus.NumClients() }, 3*time.Second, 100*time.Millisecond) + + conn.Close() + srv.Close() }