@@ -63,8 +63,8 @@ def test_blocking_call
63
63
@client . call ( *%w[ RPUSH foo hello ] )
64
64
@client . call ( *%w[ RPUSH foo world ] )
65
65
wait_for_replication
66
- client_side_timeout = 1.0
67
- server_side_timeout = 0.5
66
+ client_side_timeout = TEST_REDIS_MAJOR_VERSION < 6 ? 1.5 : 1.0
67
+ server_side_timeout = TEST_REDIS_MAJOR_VERSION < 6 ? '1' : ' 0.5'
68
68
assert_equal ( %w[ foo world ] , @client . blocking_call ( client_side_timeout , 'BRPOP' , 'foo' , server_side_timeout ) , 'Case: 1st' )
69
69
assert_equal ( %w[ foo hello ] , @client . blocking_call ( client_side_timeout , 'BRPOP' , 'foo' , server_side_timeout ) , 'Case: 2nd' )
70
70
assert_nil ( @client . blocking_call ( client_side_timeout , 'BRPOP' , 'foo' , server_side_timeout ) , 'Case: 3rd' )
@@ -129,10 +129,12 @@ def test_pipelined
129
129
wait_for_replication
130
130
131
131
want = %w[ PONG ] + ( 0 ..9 ) . map ( &:to_s ) + [ %w[ list 2 ] ]
132
+ client_side_timeout = TEST_REDIS_MAJOR_VERSION < 6 ? 1.5 : 1.0
133
+ server_side_timeout = TEST_REDIS_MAJOR_VERSION < 6 ? '1' : '0.5'
132
134
got = @client . pipelined do |pipeline |
133
135
pipeline . call_once ( 'PING' )
134
136
10 . times { |i | pipeline . call ( 'GET' , "string#{ i } " ) }
135
- pipeline . blocking_call ( 0.2 , 'BRPOP' , 'list' , '0.1' )
137
+ pipeline . blocking_call ( client_side_timeout , 'BRPOP' , 'list' , server_side_timeout )
136
138
end
137
139
assert_equal ( want , got )
138
140
end
@@ -162,22 +164,22 @@ def test_close
162
164
assert_nil ( @client . close )
163
165
end
164
166
165
- def test_dedicated_commands
167
+ def test_dedicated_commands # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
166
168
10 . times { |i | @client . call ( 'SET' , "key#{ i } " , i ) }
167
169
wait_for_replication
168
170
[
169
- { command : %w[ ACL HELP ] , is_a : Array } ,
171
+ { command : %w[ ACL HELP ] , is_a : Array , supported_redis_version : 6 } ,
170
172
{ command : [ 'WAIT' , TEST_REPLICA_SIZE , '1' ] , is_a : Integer } ,
171
173
{ command : %w[ KEYS * ] , want : ( 0 ..9 ) . map { |i | "key#{ i } " } } ,
172
174
{ command : %w[ DBSIZE ] , want : ( 0 ..9 ) . size } ,
173
175
{ command : %w[ SCAN ] , is_a : Array } ,
174
176
{ command : %w[ LASTSAVE ] , is_a : Array } ,
175
177
{ command : %w[ ROLE ] , is_a : Array } ,
176
178
{ command : %w[ CONFIG RESETSTAT ] , want : 'OK' } ,
177
- { command : %w[ CONFIG GET maxmemory ] , is_a : Hash } ,
179
+ { command : %w[ CONFIG GET maxmemory ] , is_a : TEST_REDIS_MAJOR_VERSION < 6 ? Array : Hash } ,
178
180
{ command : %w[ CLIENT LIST ] , is_a : Array } ,
179
181
{ command : %w[ CLIENT PAUSE 100 ] , want : 'OK' } ,
180
- { command : %w[ CLIENT INFO ] , is_a : String } ,
182
+ { command : %w[ CLIENT INFO ] , is_a : String , supported_redis_version : 6 } ,
181
183
{ command : %w[ CLUSTER SET-CONFIG-EPOCH 0 ] , error : ::RedisClient ::Cluster ::OrchestrationCommandNotSupported } ,
182
184
{ command : %w[ CLUSTER SAVECONFIG ] , want : 'OK' } ,
183
185
{ command : %w[ CLUSTER GETKEYSINSLOT 13252 1 ] , want : %w[ key0 ] } ,
@@ -196,6 +198,8 @@ def test_dedicated_commands
196
198
{ command : %w[ MULTI ] , error : ::RedisClient ::Cluster ::AmbiguousNodeError } ,
197
199
{ command : %w[ FLUSHDB ] , want : 'OK' }
198
200
] . each do |c |
201
+ next if c . key? ( :supported_redis_version ) && TEST_REDIS_MAJOR_VERSION < c [ :supported_redis_version ]
202
+
199
203
msg = "Case: #{ c [ :command ] . join ( ' ' ) } "
200
204
got = -> { @client . call ( *c [ :command ] ) }
201
205
if c . key? ( :error )
0 commit comments