Skip to content

test: characterize the Redis connection layer before v5 - #29

Merged
sderrow merged 1 commit into
mainfrom
sean/redis-characterization-tests
Oct 5, 2026
Merged

sderrow merged 1 commit into
mainfrom
sean/redis-characterization-tests

Conversation

@sderrow

@sderrow sderrow commented Oct 5, 2026 •

Copy link
Copy Markdown
Owner

Pin today's behavior in everything the upcoming v5 client-injection change touches. Test-only; no src changes. Passes on ioredis 5/6 and redis 4/5/6.

Gaps filled. Preserve through v5:

  • SCRIPT FLUSH mid-run: both datastores recover today.
  • A disconnected limiter stops receiving messages while siblings on its connection keep receiving and scheduling.
  • Pub/sub-driven drains run outside the constructing caller's AsyncLocalStorage context. Fails if RedisDatastore stops detaching
    connection setup.
  • Premade ioredis Cluster client: the old test never passed its connection to the limiter. It now does and asserts a separate Cluster subscriber.

Gaps filled. Intentional v5 changes, edited when the behavior changes:

  • limiter.disconnect() / group.disconnect() close connections they built; a Group leaves a shared connection open.
  • Errors from a Group-built connection reach group.on("error").
  • A connection connects (node-redis), adds an error listener to, and sets maxListeners on a passed-in client. ioredis also defines script methods on it. disconnect() strips the consumer's error listeners and closes the client.

makeConnection() with no options now builds a default connection for the current datastore, so test bodies needn't change when construction does.

Pin today's behavior in everything the v5 client-injection change touches.
Test-only; no src changes. Passes on ioredis 5/6 and redis 4/5/6.

Coverage audit (existing coverage kept as-is):
- Lua scripts: all 15 exercised end to end on both datastores.
- Error mapping (OVERWEIGHT, SETTINGS_KEY_NOT_FOUND, UNKNOWN_CLIENT):
  covered.
- Pub/sub capacity / capacity-priority drains, publish/message: covered.
- Connection sharing, deleteKey / clusterKeys / auto-cleanup: covered.
- RESP2/RESP3 normalization, heartbeat / orphaned-jobs, clearDatastore:
  covered.

Gaps filled. Preserve through v5:
- SCRIPT FLUSH mid-run: both datastores recover today.
- A disconnected limiter stops receiving messages while siblings on its
  connection keep receiving and scheduling.
- Pub/sub-driven drains run outside the constructing caller's
  AsyncLocalStorage context. Fails if RedisDatastore stops detaching
  connection setup.
- Premade ioredis Cluster client: the old test never passed its connection
  to the limiter. It now does and asserts a separate Cluster subscriber.

Gaps filled. Intentional v5 changes, edited when the behavior changes:
- limiter.disconnect() / group.disconnect() close connections they built;
  a Group leaves a shared connection open.
- Errors from a Group-built connection reach group.on("error").
- A connection connects (node-redis), adds an error listener to, and sets
  maxListeners on a passed-in client. ioredis also defines script methods
  on it. disconnect() strips the consumer's error listeners and closes the
  client.

makeConnection() with no options now builds a default connection for the
current datastore, so test bodies needn't change when construction does.

sderrow commented Oct 5, 2026

Copy link
Copy Markdown
Owner Author

@sderrow
sderrow marked this pull request as ready for review October 5, 2026 03:40
@sderrow
sderrow merged commit f0d9071 into main Oct 5, 2026
22 checks passed
@sderrow
sderrow deleted the sean/redis-characterization-tests branch October 5, 2026 03:53
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