@@ -6,9 +6,11 @@ class RedisClient
6
6
class TestCluster
7
7
module Mixin
8
8
def setup
9
+ @captured_commands = [ ]
9
10
@client = new_test_client
10
11
@client . call ( 'FLUSHDB' )
11
12
wait_for_replication
13
+ @captured_commands . clear
12
14
end
13
15
14
16
def teardown
@@ -516,10 +518,12 @@ def hiredis_used?
516
518
class PrimaryOnly < TestingWrapper
517
519
include Mixin
518
520
519
- def new_test_client
521
+ def new_test_client ( capture_buffer : @captured_commands )
520
522
config = ::RedisClient ::ClusterConfig . new (
521
523
nodes : TEST_NODE_URIS ,
522
524
fixed_hostname : TEST_FIXED_HOSTNAME ,
525
+ middlewares : [ CommandCaptureMiddleware ] ,
526
+ custom : { captured_commands : capture_buffer } ,
523
527
**TEST_GENERIC_OPTIONS
524
528
)
525
529
::RedisClient ::Cluster . new ( config )
@@ -529,12 +533,14 @@ def new_test_client
529
533
class ScaleReadRandom < TestingWrapper
530
534
include Mixin
531
535
532
- def new_test_client
536
+ def new_test_client ( capture_buffer : @captured_commands )
533
537
config = ::RedisClient ::ClusterConfig . new (
534
538
nodes : TEST_NODE_URIS ,
535
539
replica : true ,
536
540
replica_affinity : :random ,
537
541
fixed_hostname : TEST_FIXED_HOSTNAME ,
542
+ middlewares : [ CommandCaptureMiddleware ] ,
543
+ custom : { captured_commands : capture_buffer } ,
538
544
**TEST_GENERIC_OPTIONS
539
545
)
540
546
::RedisClient ::Cluster . new ( config )
@@ -544,12 +550,14 @@ def new_test_client
544
550
class ScaleReadRandomWithPrimary < TestingWrapper
545
551
include Mixin
546
552
547
- def new_test_client
553
+ def new_test_client ( capture_buffer : @captured_commands )
548
554
config = ::RedisClient ::ClusterConfig . new (
549
555
nodes : TEST_NODE_URIS ,
550
556
replica : true ,
551
557
replica_affinity : :random_with_primary ,
552
558
fixed_hostname : TEST_FIXED_HOSTNAME ,
559
+ middlewares : [ CommandCaptureMiddleware ] ,
560
+ custom : { captured_commands : capture_buffer } ,
553
561
**TEST_GENERIC_OPTIONS
554
562
)
555
563
::RedisClient ::Cluster . new ( config )
@@ -559,12 +567,14 @@ def new_test_client
559
567
class ScaleReadLatency < TestingWrapper
560
568
include Mixin
561
569
562
- def new_test_client
570
+ def new_test_client ( capture_buffer : @captured_commands )
563
571
config = ::RedisClient ::ClusterConfig . new (
564
572
nodes : TEST_NODE_URIS ,
565
573
replica : true ,
566
574
replica_affinity : :latency ,
567
575
fixed_hostname : TEST_FIXED_HOSTNAME ,
576
+ middlewares : [ CommandCaptureMiddleware ] ,
577
+ custom : { captured_commands : capture_buffer } ,
568
578
**TEST_GENERIC_OPTIONS
569
579
)
570
580
::RedisClient ::Cluster . new ( config )
@@ -574,10 +584,12 @@ def new_test_client
574
584
class Pooled < TestingWrapper
575
585
include Mixin
576
586
577
- def new_test_client
587
+ def new_test_client ( capture_buffer : @captured_commands )
578
588
config = ::RedisClient ::ClusterConfig . new (
579
589
nodes : TEST_NODE_URIS ,
580
590
fixed_hostname : TEST_FIXED_HOSTNAME ,
591
+ middlewares : [ CommandCaptureMiddleware ] ,
592
+ custom : { captured_commands : capture_buffer } ,
581
593
**TEST_GENERIC_OPTIONS
582
594
)
583
595
::RedisClient ::Cluster . new ( config , pool : { timeout : TEST_TIMEOUT_SEC , size : 2 } )
0 commit comments