Skip to content

test(sio-client): cover retry queue reconnection and exhaustion - #5569

Open
zanmlakar wants to merge 1 commit into
socketio:mainfrom
zanmlakar:test/retry-queue-reconnection
Open

zanmlakar wants to merge 1 commit into
socketio:mainfrom
zanmlakar:test/retry-queue-reconnection

Conversation

@zanmlakar

Copy link
Copy Markdown

The kind of change this PR does introduce

  • a bug fix
  • a new feature
  • an update to the documentation
  • a code change that improves performance
  • other: regression tests

Current behavior

The retry tests cover initial packet ordering, failure of a single packet, buffering before connection, and emissions from a connect handler. They do not cover retransmitting an in-flight unacknowledged packet after a transport disconnect without ackTimeout, or advancing the queue after exhausting a packet's retries.

New behavior

Add two tests using the existing real Socket.IO server fixture. The first closes the underlying connection after the server receives the unacknowledged packet and verifies it is retried on reconnection. The second verifies that one retry means two delivery attempts, the failed callback receives an error, and the next queued event is then acknowledged successfully.

The production implementation is unchanged.

Other information (e.g. related issues)

Validation on Node 24.21.0:

  • npm test --workspace=socket.io-client: formatting, TypeScript compilation, and 114 passing tests.
  • npm run build --workspace=socket.io-client: all bundles generated successfully.
  • Relevant dependency workspace compilation and git diff --check passed.

Mutation checks establish the new coverage:

  • Replacing the forced queue drain on connection with a non-forced drain fails only the new reconnection test in the retry suite.
  • Returning immediately after an exhausted packet's error callback fails only the new queue advancement test in the retry suite.
  • Both mutations were reverted.

These are additional tests for existing behavior, not a fix for an open issue.

The browser/Sauce suite was not run. The TypeScript compilation checks the client library; test files run through the existing tsx test runner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant