@@ -273,6 +273,7 @@ def test_global_pubsub
273
273
assert_equal ( [ 'subscribe' , channel , 1 ] , pubsub . next_event ( TEST_TIMEOUT_SEC ) )
274
274
Fiber . yield ( channel )
275
275
Fiber . yield ( pubsub . next_event ( TEST_TIMEOUT_SEC ) )
276
+ pubsub . call ( 'UNSUBSCRIBE' )
276
277
pubsub . close
277
278
end
278
279
@@ -289,6 +290,7 @@ def test_global_pubsub_without_timeout
289
290
assert_equal ( want , got )
290
291
Fiber . yield ( 'my-global-published-channel' )
291
292
Fiber . yield ( collect_messages ( pubsub , size : 1 , timeout : nil ) . first )
293
+ pubsub . call ( 'UNSUBSCRIBE' )
292
294
pubsub . close
293
295
end
294
296
@@ -304,6 +306,7 @@ def test_global_pubsub_with_multiple_channels
304
306
10 . times { |i | assert_equal ( [ 'subscribe' , "g-chan#{ i } " , i + 1 ] , got [ i ] ) }
305
307
Fiber . yield
306
308
Fiber . yield ( collect_messages ( pubsub , size : 10 ) )
309
+ pubsub . call ( 'UNSUBSCRIBE' )
307
310
pubsub . close
308
311
end
309
312
@@ -325,6 +328,7 @@ def test_sharded_pubsub
325
328
assert_equal ( [ 'ssubscribe' , channel , 1 ] , pubsub . next_event ( TEST_TIMEOUT_SEC ) )
326
329
Fiber . yield ( channel )
327
330
Fiber . yield ( pubsub . next_event ( TEST_TIMEOUT_SEC ) )
331
+ pubsub . call ( 'SUNSUBSCRIBE' )
328
332
pubsub . close
329
333
end
330
334
@@ -347,6 +351,7 @@ def test_sharded_pubsub_without_timeout
347
351
assert_equal ( want , got )
348
352
Fiber . yield ( 'my-sharded-published-channel' )
349
353
Fiber . yield ( collect_messages ( pubsub , size : 1 , timeout : nil ) . first )
354
+ pubsub . call ( 'SUNSUBSCRIBE' )
350
355
pubsub . close
351
356
end
352
357
@@ -367,6 +372,7 @@ def test_sharded_pubsub_with_multiple_channels
367
372
10 . times { |i | assert_equal ( [ 'ssubscribe' , "s-chan#{ i } " ] , got [ i ] . take ( 2 ) ) }
368
373
Fiber . yield
369
374
Fiber . yield ( collect_messages ( pubsub , size : 10 ) )
375
+ pubsub . call ( 'SUNSUBSCRIBE' )
370
376
pubsub . close
371
377
end
372
378
@@ -376,6 +382,19 @@ def test_sharded_pubsub_with_multiple_channels
376
382
10 . times { |i | assert_equal ( [ 'smessage' , "s-chan#{ i } " , i . to_s ] , got [ i ] ) }
377
383
end
378
384
385
+ def test_other_pubsub_commands
386
+ assert_instance_of ( Array , @client . call ( 'pubsub' , 'channels' ) )
387
+ assert_instance_of ( Integer , @client . call ( 'pubsub' , 'numpat' ) )
388
+ assert_instance_of ( Hash , @client . call ( 'pubsub' , 'numsub' ) )
389
+ assert_instance_of ( Array , @client . call ( 'pubsub' , 'shardchannels' ) ) if TEST_REDIS_MAJOR_VERSION >= 7
390
+ assert_instance_of ( Hash , @client . call ( 'pubsub' , 'shardnumsub' ) ) if TEST_REDIS_MAJOR_VERSION >= 7
391
+ ps = @client . pubsub
392
+ assert_nil ( ps . call ( 'unsubscribe' ) )
393
+ assert_nil ( ps . call ( 'punsubscribe' ) )
394
+ assert_nil ( ps . call ( 'sunsubscribe' ) ) if TEST_REDIS_MAJOR_VERSION >= 7
395
+ ps . close
396
+ end
397
+
379
398
def test_dedicated_commands # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
380
399
10 . times { |i | @client . call ( 'SET' , "key#{ i } " , i ) }
381
400
wait_for_replication
0 commit comments