@@ -104,6 +104,33 @@ var object = crud.MapObject{
104
104
"name" : "bla" ,
105
105
}
106
106
107
+ func connect (t testing.TB ) * tarantool.Connection {
108
+ for i := 0 ; i < 10 ; i ++ {
109
+ conn , err := tarantool .Connect (server , opts )
110
+ if err != nil {
111
+ t .Fatalf ("Failed to connect: %s" , err )
112
+ }
113
+
114
+ ret := struct {
115
+ _msgpack struct {} `msgpack:",asArray"` //nolint: structcheck,unused
116
+ Result bool
117
+ }{}
118
+ err = conn .Do (tarantool .NewCall17Request ("is_ready" )).GetTyped (& ret )
119
+ if err != nil {
120
+ t .Fatalf ("Failed to check is_ready: %s" , err )
121
+ }
122
+
123
+ if ret .Result {
124
+ return conn
125
+ }
126
+
127
+ time .Sleep (time .Second )
128
+ }
129
+
130
+ t .Fatalf ("Failed to wait for a ready state connect." )
131
+ return nil
132
+ }
133
+
107
134
var testProcessDataCases = []struct {
108
135
name string
109
136
expectedRespLen int
@@ -454,7 +481,7 @@ func testCrudRequestCheck(t *testing.T, req tarantool.Request,
454
481
}
455
482
456
483
func TestCrudGenerateData (t * testing.T ) {
457
- conn := test_helpers . ConnectWithValidation ( t , server , opts )
484
+ conn := connect ( t )
458
485
defer conn .Close ()
459
486
460
487
for _ , testCase := range testGenerateDataCases {
@@ -477,7 +504,7 @@ func TestCrudGenerateData(t *testing.T) {
477
504
}
478
505
479
506
func TestCrudProcessData (t * testing.T ) {
480
- conn := test_helpers . ConnectWithValidation ( t , server , opts )
507
+ conn := connect ( t )
481
508
defer conn .Close ()
482
509
483
510
for _ , testCase := range testProcessDataCases {
@@ -527,7 +554,7 @@ func TestUnflattenRows(t *testing.T) {
527
554
tpls []interface {}
528
555
)
529
556
530
- conn := test_helpers . ConnectWithValidation ( t , server , opts )
557
+ conn := connect ( t )
531
558
defer conn .Close ()
532
559
533
560
// Do `replace`.
@@ -586,7 +613,7 @@ func TestUnflattenRows(t *testing.T) {
586
613
}
587
614
588
615
func TestResultWithErr (t * testing.T ) {
589
- conn := test_helpers . ConnectWithValidation ( t , server , opts )
616
+ conn := connect ( t )
590
617
defer conn .Close ()
591
618
592
619
for _ , testCase := range testResultWithErrCases {
@@ -601,7 +628,7 @@ func TestResultWithErr(t *testing.T) {
601
628
}
602
629
603
630
func TestBoolResult (t * testing.T ) {
604
- conn := test_helpers . ConnectWithValidation ( t , server , opts )
631
+ conn := connect ( t )
605
632
defer conn .Close ()
606
633
607
634
req := crud .MakeTruncateRequest (spaceName ).Opts (baseOpts )
@@ -624,7 +651,7 @@ func TestBoolResult(t *testing.T) {
624
651
}
625
652
626
653
func TestNumberResult (t * testing.T ) {
627
- conn := test_helpers . ConnectWithValidation ( t , server , opts )
654
+ conn := connect ( t )
628
655
defer conn .Close ()
629
656
630
657
req := crud .MakeCountRequest (spaceName ).Opts (countOpts )
@@ -665,7 +692,7 @@ func TestBaseResult(t *testing.T) {
665
692
},
666
693
}
667
694
668
- conn := test_helpers . ConnectWithValidation ( t , server , opts )
695
+ conn := connect ( t )
669
696
defer conn .Close ()
670
697
671
698
req := crud .MakeSelectRequest (spaceName ).Opts (selectOpts )
@@ -708,7 +735,7 @@ func TestManyResult(t *testing.T) {
708
735
},
709
736
}
710
737
711
- conn := test_helpers . ConnectWithValidation ( t , server , opts )
738
+ conn := connect ( t )
712
739
defer conn .Close ()
713
740
714
741
req := crud .MakeReplaceManyRequest (spaceName ).Tuples (tuples ).Opts (opManyOpts )
@@ -733,7 +760,7 @@ func TestManyResult(t *testing.T) {
733
760
}
734
761
735
762
func TestStorageInfoResult (t * testing.T ) {
736
- conn := test_helpers . ConnectWithValidation ( t , server , opts )
763
+ conn := connect ( t )
737
764
defer conn .Close ()
738
765
739
766
req := crud .MakeStorageInfoRequest ().Opts (baseOpts )
0 commit comments