Add Redis Storage Integration Tests with Testcontainers#3785
Add Redis Storage Integration Tests with Testcontainers#3785tgrunnagle merged 3 commits intomainfrom
Conversation
There was a problem hiding this comment.
Large PR Detected
This PR exceeds 1000 lines of changes and requires justification before it can be reviewed.
How to unblock this PR:
Add a section to your PR description with the following format:
## Large PR Justification
[Explain why this PR must be large, such as:]
- Generated code that cannot be split
- Large refactoring that must be atomic
- Multiple related changes that would break if separated
- Migration or data transformationAlternative:
Consider splitting this PR into smaller, focused changes (< 1000 lines each) for easier review and reduced risk.
See our Contributing Guidelines for more details.
This review will be automatically dismissed once you add the justification section.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3785 +/- ##
==========================================
+ Coverage 66.78% 66.83% +0.05%
==========================================
Files 437 438 +1
Lines 43002 43321 +319
==========================================
+ Hits 28718 28954 +236
- Misses 12078 12123 +45
- Partials 2206 2244 +38 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
9c9a0a2 to
01f0c06
Compare
Large PR justification has been provided. Thank you!
|
✅ Large PR justification has been provided. The size review has been dismissed and this PR can now proceed with normal review. |
jhrozek
left a comment
There was a problem hiding this comment.
I think it's fine merging the test as-is but it wasn't clear to me how the tests are ran..
- `test-integration` task target - wrap `context.Background()` in `context.WithTimeout` - filemode `0o644` in test
Depends on #3639
Closes #3629
Summary
Adds comprehensive integration tests for the Redis Sentinel storage backend using testcontainers-go. These tests validate the
RedisStorageimplementation against a real Redis Sentinel cluster (1 primary + 2 replicas + 3 sentinels), covering behavior that cannot be verified with the miniredis mock used in unit tests—including Sentinel failover, ACL authentication, real TTL expiration, and concurrent access under actual network conditions.Changes Made
Integration Test Suite (
pkg/authserver/storage/redis_integration_test.go)~thv:*key pattern restriction) on all Redis nodesDialeraddress translation to work around Docker-internal IPs being unreachable from macOS hostsTestMainfor shared cluster lifecycle with graceful skip when Docker is unavailableStorage Interface Coverage
Storageinterface methods: clients, authorization codes, access tokens, refresh tokens, PKCE, upstream tokens, pending authorizations, users, and provider identitiesSentinel-Specific Tests
WAIT 1 5000), triggers failover, verifies data survives and new writes succeed on the promoted primaryACL Authentication Tests
thv:*key operationsthv:*keys are denied)TTL and Expiration Tests
Concurrent Access Tests
Edge Cases
Implementation Details
//go:build integrationtag, excluded fromtask testby defaultDeriveKeyPrefix("inttest", sanitizedTestName)to prevent cross-test interferencewithIntegrationStoragehelperTesting
Storageinterface methods plus Sentinel, ACL, TTL, concurrency, and Unicode edge casesgo test -tags integration -v -timeout 5m ./pkg/authserver/storage/testcontainers-godependency added togo.modLarge PR Justification