@@ -12,6 +12,8 @@ import (
12
12
"github.com/google/uuid"
13
13
"github.com/stretchr/testify/require"
14
14
"github.com/tarantool/go-tarantool/v2"
15
+ "github.com/tarantool/go-tarantool/v2/box"
16
+ "github.com/tarantool/go-tarantool/v2/pool"
15
17
"github.com/tarantool/go-tarantool/v2/test_helpers"
16
18
vshardrouter "github.com/tarantool/go-vshard-router"
17
19
"github.com/tarantool/go-vshard-router/providers/static"
@@ -611,3 +613,29 @@ func testRouterRouteWithMode(t *testing.T, searchMode vshardrouter.BucketsSearch
611
613
}
612
614
}
613
615
}
616
+
617
+ // TestReplicaset_Pooler tests that pooler logic works ok with replicaset.
618
+ func TestReplicaset_Pooler (t * testing.T ) {
619
+ ctx := context .Background ()
620
+
621
+ router , err := vshardrouter .NewRouter (ctx , vshardrouter.Config {
622
+ TopologyProvider : static .NewProvider (topology ),
623
+ DiscoveryTimeout : 5 * time .Second ,
624
+ DiscoveryMode : vshardrouter .DiscoveryModeOn ,
625
+ TotalBucketCount : totalBucketCount ,
626
+ User : username ,
627
+ })
628
+ require .Nil (t , err , "NewRouter created successfully" )
629
+
630
+ t .Run ("go-tarantool box module works ok with go-vshard replicaset" , func (t * testing.T ) {
631
+ // check that masters are alive
632
+ for _ , rs := range router .RouteAll () {
633
+ b := box .New (pool .NewConnectorAdapter (rs .Pooler (), pool .RW ))
634
+ require .NotNil (t , b )
635
+
636
+ info , err := b .Info ()
637
+ require .NoError (t , err , "master respond info" )
638
+ require .False (t , info .RO , "it is not RO" )
639
+ }
640
+ })
641
+ }
0 commit comments