mirror of
https://github.com/redis/go-redis.git
synced 2025-12-18 23:34:11 +03:00
fix(retry): Add retry mechanism for NOREPLICAS error (#3647)
This commit is contained in:
@@ -9,12 +9,12 @@ import (
|
||||
// TestTypedRedisErrors tests that typed Redis errors are created correctly
|
||||
func TestTypedRedisErrors(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
errorMsg string
|
||||
expectedType interface{}
|
||||
expectedMsg string
|
||||
checkFunc func(error) bool
|
||||
extractAddr func(error) string
|
||||
name string
|
||||
errorMsg string
|
||||
expectedType interface{}
|
||||
expectedMsg string
|
||||
checkFunc func(error) bool
|
||||
extractAddr func(error) string
|
||||
}{
|
||||
{
|
||||
name: "LOADING error",
|
||||
@@ -132,6 +132,13 @@ func TestTypedRedisErrors(t *testing.T) {
|
||||
expectedMsg: "OOM command not allowed when used memory > 'maxmemory'",
|
||||
checkFunc: IsOOMError,
|
||||
},
|
||||
{
|
||||
name: "NOREPLICAS error",
|
||||
errorMsg: "NOREPLICAS Not enough good replicas to write",
|
||||
expectedType: &NoReplicasError{},
|
||||
expectedMsg: "NOREPLICAS Not enough good replicas to write",
|
||||
checkFunc: IsNoReplicasError,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
@@ -389,4 +396,3 @@ func TestBackwardCompatibility(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user