Skip to content

health: flaky socket mode unit testsΒ #2138

@WilliamBergamin

Description

@WilliamBergamin

Packages:

Select all that apply:

  • @slack/web-api
  • @slack/rtm-api
  • @slack/webhooks
  • @slack/oauth
  • @slack/socket-mode
  • @slack/types
  • I don't know

Expected result:

Unit tests should be stable and only fail when an undesirable change is introduced

Actual result:

Inconsistently the tests for socket mode fail in our CI pipeline, this may have been introduced in #2099 due to the failing tests reporting Unexpected server response: 409

Error:   socket-mode:SlackWebSocket:983 WebSocket error occurred: Unexpected server response: 409
Error:   socket-mode:SocketModeClient:889 WebSocket error! Error: Unexpected server response: 409
Error:   socket-mode:SlackWebSocket:984 WebSocket error occurred: Unexpected server response: 409
Error:   socket-mode:SocketModeClient:889 WebSocket error! Error: Unexpected server response: 409
Error:   socket-mode:SlackWebSocket:985 WebSocket error occurred: Unexpected server response: 409
Error:   socket-mode:SocketModeClient:889 WebSocket error! Error: Unexpected server response: 409
          15) should reconnect if server does not send `ping` message within specified server ping timeout
          16) should reconnect if server does not respond with `pong` message within specified client ping timeout 
          17) should reconnect if server does not respond with `pong` message within specified client ping timeout after initially responding with `pong`
  6 passing (30s)
  17 failing
  1) Integration tests with a WebSocket server
       unexpected socket messages sent to client
         should maintain one serial reconnection attempt if WSS server sends unexpected HTTP response during handshake, like a 409:
      unexpected number of times `close` event was raised during reconnection!
      + expected - actual
      -1
      +2
      
      at Context.<anonymous> (test\integration.spec.js:208:14)
  2) Integration tests with a WebSocket server
       "before each" hook in "Integration tests with a WebSocket server":
     done() called multiple times in hook <Integration tests with a WebSocket server "before each" hook in "Integration tests with a WebSocket server"> of file D:\a\node-slack-sdk\node-slack-sdk\packages\socket-mode\test\integration.spec.js; in addition, done() received error: Error: listen EADDRINUSE: address already in use :::23456
    at Server.setupListenHandle [as _listen2] (node:net:1817:16)
    at listenInCluster (node:net:1865:12)
    at Server.listen (node:net:1953:7)
    at new WebSocketServer (D:\a\node-slack-sdk\node-slack-sdk\packages\socket-mode\node_modules\ws\lib\websocket-server.js:102:20)
    at Context.<anonymous> (D:\a\node-slack-sdk\node-slack-sdk\packages\socket-mode\test\integration.spec.js:34:11)
    at callFn (D:\a\node-slack-sdk\node-slack-sdk\packages\socket-mode\node_modules\mocha\lib\runnable.js:364:21)
    at Hook.Runnable.run (D:\a\node-slack-sdk\node-slack-sdk\packages\socket-mode\node_modules\mocha\lib\runnable.js:352:5)
    at next (D:\a\node-slack-sdk\node-slack-sdk\packages\socket-mode\node_modules\mocha\lib\runner.js:509:10)
    at Immediate.<anonymous> (D:\a\node-slack-sdk\node-slack-sdk\packages\socket-mode\node_modules\mocha\lib\runner.js:570:5)
    at processImmediate (node:internal/timers:476:21) {
  code: 'EADDRINUSE',
  errno: -4091,
  syscall: 'listen',
  address: '::',
  port: 23456,
  uncaught: true
}
  Error: done() called multiple times in hook <Integration tests with a WebSocket server "before each" hook in "Integration tests with a WebSocket server"> of file D:\a\node-slack-sdk\node-slack-sdk\packages\socket-mode\test\integration.spec.js; in addition, done() received error: Error: listen EADDRINUSE: address already in use :::23456
      at Server.setupListenHandle [as _listen2] (node:net:1817:16)
      at listenInCluster (node:net:1865:12)
      at Server.listen (node:net:1953:7)
      at new WebSocketServer (node_modules\ws\lib\websocket-server.js:102:20)
      at Context.<anonymous> (test\integration.spec.js:34:11)
      at processImmediate (node:internal/timers:476:21) {
    code: 'EADDRINUSE',
    errno: -4091,
    syscall: 'listen',
    address: '::',
    port: 23456,
    uncaught: true
  }
      at process.emit (node:events:529:35)
      at process.emit (node:domain:489:12)
      at process.emit.sharedData.processEmitHook.installedValue [as emit] (node_modules\@cspotcode\source-map-support\source-map-support.js:745:40)
      at process._fatalException (node:internal/process/execution:169:25)
  3) Integration tests with a WebSocket server
       lifecycle events
         raises connecting event during `start()`:
     Error: Timeout of 3000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (D:\a\node-slack-sdk\node-slack-sdk\packages\socket-mode\test\integration.spec.js)
      at listOnTimeout (node:internal/timers:569:17)
      at processTimers (node:internal/timers:512:7)
  4) Integration tests with a WebSocket server
       lifecycle events
         raises authenticated event during `start()`:
     Error: Timeout of 3000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (D:\a\node-slack-sdk\node-slack-sdk\packages\socket-mode\test\integration.spec.js)
      at listOnTimeout (node:internal/timers:569:17)
      at processTimers (node:internal/timers:512:7)
  5) Integration tests with a WebSocket server
       lifecycle events
         raises connected event during `start()`:
     Error: Timeout of 3000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (D:\a\node-slack-sdk\node-slack-sdk\packages\socket-mode\test\integration.spec.js)
      at listOnTimeout (node:internal/timers:569:17)
      at processTimers (node:internal/timers:512:7)
  6) Integration tests with a WebSocket server
       lifecycle events
         raises disconnecting event during `disconnect()`:
     Error: Timeout of 3000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (D:\a\node-slack-sdk\node-slack-sdk\packages\socket-mode\test\integration.spec.js)
      at listOnTimeout (node:internal/timers:569:17)
      at processTimers (node:internal/timers:512:7)
  7) Integration tests with a WebSocket server
       lifecycle events
         raises disconnected event after `disconnect()`:
     Error: Timeout of 3000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (D:\a\node-slack-sdk\node-slack-sdk\packages\socket-mode\test\integration.spec.js)
      at listOnTimeout (node:internal/timers:569:17)
      at processTimers (node:internal/timers:512:7)
  8) Integration tests with a WebSocket server
       lifecycle events
         slack_event
           should not raise a type:disconnect reason:warning message as a slack_event:
     Error: Promise rejected with no or falsy reason
      at processTicksAndRejections (node:internal/process/task_queues:95:5)
  9) Integration tests with a WebSocket server
       lifecycle events
         slack_event
           should not raise a type:disconnect reason:refresh_requested message as a slack_event:
     Error: Promise rejected with no or falsy reason
      at processTicksAndRejections (node:internal/process/task_queues:95:5)
  10) Integration tests with a WebSocket server
       lifecycle events
         slack_event
           should not raise a type:disconnect reason:too_many_websockets message as a slack_event:
     Error: Promise rejected with no or falsy reason
      at processTicksAndRejections (node:internal/process/task_queues:95:5)
  11) Integration tests with a WebSocket server
       lifecycle events
         including reconnection ability
           raises reconnecting event after peer disconnects underlying WS connection:
     Error: Timeout of 3000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (D:\a\node-slack-sdk\node-slack-sdk\packages\socket-mode\test\integration.spec.js)
      at listOnTimeout (node:internal/timers:569:17)
      at processTimers (node:internal/timers:512:7)
  12) Integration tests with a WebSocket server
       lifecycle events
         including reconnection ability
           should reconnect gracefully if server sends a disconnect (reason: warning) message:
     Error: Timeout of 3000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (D:\a\node-slack-sdk\node-slack-sdk\packages\socket-mode\test\integration.spec.js)
      at listOnTimeout (node:internal/timers:569:17)
      at processTimers (node:internal/timers:512:7)
  13) Integration tests with a WebSocket server
       lifecycle events
         including reconnection ability
           should reconnect gracefully if server sends a disconnect (reason: refresh_requested) message:
     Error: Timeout of 3000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (D:\a\node-slack-sdk\node-slack-sdk\packages\socket-mode\test\integration.spec.js)
      at listOnTimeout (node:internal/timers:569:17)
      at processTimers (node:internal/timers:512:7)
  14) Integration tests with a WebSocket server
       lifecycle events
         including reconnection ability
           should reconnect gracefully if server sends a disconnect (reason: too_many_websockets) message:
     Error: Timeout of 3000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (D:\a\node-slack-sdk\node-slack-sdk\packages\socket-mode\test\integration.spec.js)
      at listOnTimeout (node:internal/timers:569:17)
      at processTimers (node:internal/timers:512:7)
  15) Integration tests with a WebSocket server
       lifecycle events
         including reconnection ability
           related to ping/pong events
             should reconnect if server does not send `ping` message within specified server ping timeout:
     Error: Timeout of 3000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (D:\a\node-slack-sdk\node-slack-sdk\packages\socket-mode\test\integration.spec.js)
      at listOnTimeout (node:internal/timers:569:17)
      at processTimers (node:internal/timers:512:7)
  16) Integration tests with a WebSocket server
       lifecycle events
         including reconnection ability
           related to ping/pong events
             should reconnect if server does not respond with `pong` message within specified client ping timeout :
     Uncaught Error: listen EADDRINUSE: address already in use :::23456
      at Server.setupListenHandle [as _listen2] (node:net:1817:16)
      at listenInCluster (node:net:1865:12)
      at Server.listen (node:net:1953:7)
      at new WebSocketServer (node_modules\ws\lib\websocket-server.js:102:20)
      at Context.<anonymous> (test\integration.spec.js:361:17)
      at processImmediate (node:internal/timers:476:21)
  17) Integration tests with a WebSocket server
       lifecycle events
         including reconnection ability
           related to ping/pong events
             should reconnect if server does not respond with `pong` message within specified client ping timeout after initially responding with `pong`:
     Uncaught Error: listen EADDRINUSE: address already in use :::23456
      at Server.setupListenHandle [as _listen2] (node:net:1817:16)
      at listenInCluster (node:net:1865:12)
      at Server.listen (node:net:1953:7)
      at new WebSocketServer (node_modules\ws\lib\websocket-server.js:102:20)
      at Context.<anonymous> (test\integration.spec.js:384:17)
      at processImmediate (node:internal/timers:476:21)
Terminate batch job (Y/N)? 

Requirements

For general questions/issues about Slack API platform or its server-side, could you submit questions at https://my.slack.com/help/requests/new instead. πŸ™‡

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

Metadata

Metadata

Assignees

No one assigned

    Labels

    auto-triage-skipbugM-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documentedpkg:socket-modeapplies to `@slack/socket-mode`testsM-T: Testing work only

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions