@@ -1252,6 +1252,45 @@ func TestPing(t *testing.T) {
1252
1252
require .NotNilf (t , resp , "response is nil after Ping" )
1253
1253
}
1254
1254
1255
+ func TestDo (t * testing.T ) {
1256
+ roles := []bool {true , true , false , true , false }
1257
+
1258
+ err := test_helpers .SetClusterRO (servers , connOpts , roles )
1259
+ require .Nilf (t , err , "fail to set roles for cluster" )
1260
+
1261
+ connPool , err := connection_pool .Connect (servers , connOpts )
1262
+ require .Nilf (t , err , "failed to connect" )
1263
+ require .NotNilf (t , connPool , "conn is nil after Connect" )
1264
+
1265
+ defer connPool .Close ()
1266
+
1267
+ req := tarantool .NewPingRequest ()
1268
+ // ANY
1269
+ resp , err := connPool .Do (req , connection_pool .ANY )
1270
+ require .Nilf (t , err , "failed to Ping" )
1271
+ require .NotNilf (t , resp , "response is nil after Ping" )
1272
+
1273
+ // RW
1274
+ resp , err = connPool .Do (req , connection_pool .RW )
1275
+ require .Nilf (t , err , "failed to Ping" )
1276
+ require .NotNilf (t , resp , "response is nil after Ping" )
1277
+
1278
+ // RO
1279
+ resp , err = connPool .Do (req , connection_pool .RO )
1280
+ require .Nilf (t , err , "failed to Ping" )
1281
+ require .NotNilf (t , resp , "response is nil after Ping" )
1282
+
1283
+ // PreferRW
1284
+ resp , err = connPool .Do (req , connection_pool .PreferRW )
1285
+ require .Nilf (t , err , "failed to Ping" )
1286
+ require .NotNilf (t , resp , "response is nil after Ping" )
1287
+
1288
+ // PreferRO
1289
+ resp , err = connPool .Do (req , connection_pool .PreferRO )
1290
+ require .Nilf (t , err , "failed to Ping" )
1291
+ require .NotNilf (t , resp , "response is nil after Ping" )
1292
+ }
1293
+
1255
1294
// runTestMain is a body of TestMain function
1256
1295
// (see https://pkg.go.dev/testing#hdr-Main).
1257
1296
// Using defer + os.Exit is not works so TestMain body
0 commit comments