-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Description
After upgrading to Valkey 9.0.0, four integration tests are failing related to the new multi-database support for cluster clients. These tests were previously skipped on Valkey 8.x but now run and fail on Valkey 9.0.
Environment
- Valkey Version: 9.0.0
- Test Framework: xUnit
- Target Framework: .NET 8.0
- Test Project:
Valkey.Glide.IntegrationTests
Failing Tests
1. TestKeyMoveAsync (2 failures - RESP2 and RESP3)
Error: ResponseError: DB index is out of range
Location: ClusterClientTests.cs:559
Test Code:
// Move the key to database 1
bool moveResult = await client.KeyMoveAsync(key, 1);Root Cause: The cluster may not be configured with multiple databases enabled, or the database index is invalid for the cluster configuration.
2. TestKeyCopyAsync (2 failures - RESP2 and RESP3)
Error: CrossSlot: Keys in request don't hash to the same slot
Location: ClusterClientTests.cs:583
Test Code:
string sourceKey = Guid.NewGuid().ToString();
string destKey = Guid.NewGuid().ToString();
// ...
bool copyResult = await client.KeyCopyAsync(sourceKey, destKey, 1);Root Cause: In cluster mode, when copying keys across databases, both source and destination keys must hash to the same slot. The test uses random GUIDs which don't guarantee same-slot hashing.
Proposed Solutions
For TestKeyMoveAsync
- Verify cluster is configured with
cluster-allow-databases yesin Valkey 9.0 - Ensure the test uses a valid database index for the cluster configuration
- Consider adding cluster configuration validation before running the test
For TestKeyCopyAsync
Use hash tags to ensure keys hash to the same slot:
string sourceKey = $"{{test}}{Guid.NewGuid()}";
string destKey = $"{{test}}{Guid.NewGuid()}";The {test} portion ensures both keys hash to the same slot in cluster mode.
Test Output
Test summary: total: 2106, failed: 4, succeeded: 2102, skipped: 0, duration: 169.3s
Failures:
- Valkey.Glide.IntegrationTests.ClusterClientTests.TestKeyMoveAsync(client: GlideClusterClient RESP2)
- Valkey.Glide.IntegrationTests.ClusterClientTests.TestKeyMoveAsync(client: GlideClusterClient RESP3)
- Valkey.Glide.IntegrationTests.ClusterClientTests.TestKeyCopyAsync(client: GlideClusterClient RESP2)
- Valkey.Glide.IntegrationTests.ClusterClientTests.TestKeyCopyAsync(client: GlideClusterClient RESP3)
Additional Context
These tests were introduced to validate Valkey 9.0's new multi-database support for cluster clients. The feature is documented in the Valkey 9.0 release notes as a major enhancement allowing clusters to support multiple databases (previously only database 0 was supported in cluster mode).
Related Tests
The following tests pass successfully and can serve as reference implementations:
TestClusterDatabaseId- Basic database selectionTestSelect- Database switching in cluster mode
Priority
Medium - These are new feature tests that don't affect existing functionality. However, they should be fixed to ensure proper validation of Valkey 9.0 multi-database cluster features.