@@ -273,6 +273,7 @@ def test_global_pubsub
273273 assert_equal ( [ 'subscribe' , channel , 1 ] , pubsub . next_event ( TEST_TIMEOUT_SEC ) )
274274 Fiber . yield ( channel )
275275 Fiber . yield ( pubsub . next_event ( TEST_TIMEOUT_SEC ) )
276+ pubsub . call ( 'UNSUBSCRIBE' )
276277 pubsub . close
277278 end
278279
@@ -289,6 +290,7 @@ def test_global_pubsub_without_timeout
289290 assert_equal ( want , got )
290291 Fiber . yield ( 'my-global-published-channel' )
291292 Fiber . yield ( collect_messages ( pubsub , size : 1 , timeout : nil ) . first )
293+ pubsub . call ( 'UNSUBSCRIBE' )
292294 pubsub . close
293295 end
294296
@@ -304,6 +306,7 @@ def test_global_pubsub_with_multiple_channels
304306 10 . times { |i | assert_equal ( [ 'subscribe' , "g-chan#{ i } " , i + 1 ] , got [ i ] ) }
305307 Fiber . yield
306308 Fiber . yield ( collect_messages ( pubsub , size : 10 ) )
309+ pubsub . call ( 'UNSUBSCRIBE' )
307310 pubsub . close
308311 end
309312
@@ -325,6 +328,7 @@ def test_sharded_pubsub
325328 assert_equal ( [ 'ssubscribe' , channel , 1 ] , pubsub . next_event ( TEST_TIMEOUT_SEC ) )
326329 Fiber . yield ( channel )
327330 Fiber . yield ( pubsub . next_event ( TEST_TIMEOUT_SEC ) )
331+ pubsub . call ( 'SUNSUBSCRIBE' )
328332 pubsub . close
329333 end
330334
@@ -347,6 +351,7 @@ def test_sharded_pubsub_without_timeout
347351 assert_equal ( want , got )
348352 Fiber . yield ( 'my-sharded-published-channel' )
349353 Fiber . yield ( collect_messages ( pubsub , size : 1 , timeout : nil ) . first )
354+ pubsub . call ( 'SUNSUBSCRIBE' )
350355 pubsub . close
351356 end
352357
@@ -367,6 +372,7 @@ def test_sharded_pubsub_with_multiple_channels
367372 10 . times { |i | assert_equal ( [ 'ssubscribe' , "s-chan#{ i } " ] , got [ i ] . take ( 2 ) ) }
368373 Fiber . yield
369374 Fiber . yield ( collect_messages ( pubsub , size : 10 ) )
375+ pubsub . call ( 'SUNSUBSCRIBE' )
370376 pubsub . close
371377 end
372378
@@ -376,6 +382,19 @@ def test_sharded_pubsub_with_multiple_channels
376382 10 . times { |i | assert_equal ( [ 'smessage' , "s-chan#{ i } " , i . to_s ] , got [ i ] ) }
377383 end
378384
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+
379398 def test_dedicated_commands # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
380399 10 . times { |i | @client . call ( 'SET' , "key#{ i } " , i ) }
381400 wait_for_replication
0 commit comments