Add RESP3 dual-protocol testing alongside RESP2#153
Merged
Conversation
Run the entire test suite under both RESP2 (default) and RESP3 protocols to validate compatibility ahead of potential RESP3 adoption. Changes: - SharedConnection: maintain two static ConnectionMultiplexer instances (one per protocol) with the same double-check locking pattern - Each of the 9 Redis test classes gains a virtual Protocol property and a corresponding *Resp3Tests subclass that overrides it to Resp3 - RedisLockTests uses a constructor parameter to avoid virtual-call-in- constructor warnings - RedisQueueTests.DatabaseTimeoutDuringDequeueHandledCorrectly is skipped in the RESP3 subclass because it blocks the entire Redis server for 5s and would destabilize subsequent tests when run twice Related: StackExchange/StackExchange.Redis#2783
There was a problem hiding this comment.
Pull request overview
This PR expands the Foundatio.Redis integration test suite to validate compatibility across both RESP2 (default) and RESP3 by running each Redis-focused test class under both protocols using a shared connection abstraction.
Changes:
- Introduces protocol-aware Redis connection creation via
SharedConnection.GetMuxer(..., protocol)with separate cached multiplexers for RESP2 and RESP3. - Adds a
protected virtual RedisProtocol? Protocolhook to Redis integration test classes and creates*Resp3Testssubclasses to run the same tests under RESP3. - Skips the known-destructive dequeue-timeout test in the RESP3 suite to avoid destabilizing the shared Redis instance.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Foundatio.Redis.Tests/SharedConnection.cs | Adds protocol parameter and maintains separate RESP2/RESP3 multiplexers. |
| tests/Foundatio.Redis.Tests/Storage/RedisFileStorageTests.cs | Makes storage tests protocol-selectable and adds RESP3 subclass. |
| tests/Foundatio.Redis.Tests/Queues/RedisQueueTests.cs | Makes queue tests protocol-selectable, adds RESP3 subclass, and skips destructive test under RESP3. |
| tests/Foundatio.Redis.Tests/Messaging/RedisMessageBusTests.cs | Makes message bus tests protocol-selectable and adds RESP3 subclass. |
| tests/Foundatio.Redis.Tests/Locks/RedisLockTests.cs | Adds protocol selection via constructor wiring and adds RESP3 subclass. |
| tests/Foundatio.Redis.Tests/Jobs/RedisJobQueueTests.cs | Makes job queue tests protocol-selectable and adds RESP3 subclass. |
| tests/Foundatio.Redis.Tests/Caching/ScopedRedisHybridCacheClientTests.cs | Makes scoped hybrid cache tests protocol-selectable and adds RESP3 subclass. |
| tests/Foundatio.Redis.Tests/Caching/ScopedRedisCacheClientTests.cs | Makes scoped cache tests protocol-selectable and adds RESP3 subclass. |
| tests/Foundatio.Redis.Tests/Caching/RedisHybridCacheClientTests.cs | Makes hybrid cache tests protocol-selectable and adds RESP3 subclass. |
| tests/Foundatio.Redis.Tests/Caching/RedisCacheClientTests.cs | Makes cache tests protocol-selectable and adds RESP3 subclass. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Adds documentation to clarify that separate ConnectionMultiplexer instances are cached for RESP2 and RESP3, allowing the test suite to run against both protocols without reconnecting.
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
SharedConnectionnow maintains two staticConnectionMultiplexerinstances (one per protocol) with the same double-check locking pattern.RedisProtocol? Protocolproperty and a corresponding*Resp3Testssubclass that overrides it toRedisProtocol.Resp3.DatabaseTimeoutDuringDequeueHandledCorrectlytest in RESP3 since it blocks the entire Redis server for 5 seconds with a Lua busy-loop and destabilizes subsequent tests when run twice.Total test count: 888 → 1738 (every Redis integration test now runs under both protocols)
RESP3 Compatibility Notes
All Foundatio.Redis features (caching, queues, messaging, locks, storage, jobs) pass under RESP3 with no library code changes required. Areas we were watching:
RedisResultcasts ((int),(double),(long),(long[])) — StackExchange.Redis normalizes these correctly under RESP3.FlushAllAsync/ cluster operations — work identically under both protocols.Test plan
dotnet build Foundatio.Redis.slnx— 0 warnings, 0 errorsdotnet test Foundatio.Redis.slnx— 1738 total, 1691 passed, 47 skipped, 0 failed