fix(test): race condition in spub/ssub auto-resubscription test#2092
Merged
PavelPashov merged 1 commit intoredis:mainfrom Apr 2, 2026
Merged
Conversation
Changed disconnect({ reconnect: true }) to disconnect(true) to ensure
proper reconnection behavior during auto-resubscription testing.
PavelPashov
approved these changes
Apr 2, 2026
Contributor
PavelPashov
left a comment
There was a problem hiding this comment.
Thanks for your contribution. LGTM
rit3sh-x
added a commit
to rit3sh-x/ioredis
that referenced
this pull request
Apr 4, 2026
Follow-up to redis#2092. Await initial ssubscribe calls and poll for stub.callCount before asserting, so the test is stable under load.
2 tasks
simong
added a commit
to simong/ioredis
that referenced
this pull request
Apr 8, 2026
…dying * origin: feat: Implement `TracingChannel` support (redis#2089) chore(ci): add custom Redis version to test matrix (redis#2067) chore(deps): update and pin production dependencies (redis#2087) test: race condition in spub/ssub auto-resubscription test (redis#2092) chore(release): 5.10.1 [skip ci] fix(cluster): lazily start sharded subscribers (redis#2090) chore(release): 5.10.0 [skip ci] feat: add hash field expiration commands and tests feat: add hexpireat & hexpiretime (redis#2082) ci: make Coveralls steps non-blocking in test_with_cov workflow (redis#2083)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a flaky test that intermittently fails with
TypeError: Cannot read properties of null (reading 'args')atspub_ssub.ts:168.Root cause
subscriber.disconnect({ reconnect: true })wasn't triggering proper reconnection, so the sinon stub didn't capture all 3ssubscribecalls before theassertions ran.
Fix
Changed to
subscriber.disconnect(true)which correctly triggers reconnection and auto-resubscription.Test plan
should call ssubscribe individually for each channel during auto-resubscriptionpasses consistentlyNote
Low Risk
Low risk: changes are limited to functional tests and only adjust expectations and reconnection triggering to reduce flakiness.
Overview
Fixes a flaky
spub/ssubfunctional test by triggering reconnect viasubscriber.disconnect(true)so auto-resubscription reliably replays the threessubscribecalls before assertions run.Also makes the subscriber-mode error assertion tolerant of a possibly undefined error object by matching on
err?.message.Written by Cursor Bugbot for commit b4cb5e6. This will update automatically on new commits. Configure here.