@@ -104,6 +104,33 @@ var object = crud.MapObject{
104104 "name" : "bla" ,
105105}
106106
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+
107134var testProcessDataCases = []struct {
108135 name string
109136 expectedRespLen int
@@ -454,7 +481,7 @@ func testCrudRequestCheck(t *testing.T, req tarantool.Request,
454481}
455482
456483func TestCrudGenerateData (t * testing.T ) {
457- conn := test_helpers . ConnectWithValidation ( t , server , opts )
484+ conn := connect ( t )
458485 defer conn .Close ()
459486
460487 for _ , testCase := range testGenerateDataCases {
@@ -477,7 +504,7 @@ func TestCrudGenerateData(t *testing.T) {
477504}
478505
479506func TestCrudProcessData (t * testing.T ) {
480- conn := test_helpers . ConnectWithValidation ( t , server , opts )
507+ conn := connect ( t )
481508 defer conn .Close ()
482509
483510 for _ , testCase := range testProcessDataCases {
@@ -527,7 +554,7 @@ func TestUnflattenRows(t *testing.T) {
527554 tpls []interface {}
528555 )
529556
530- conn := test_helpers . ConnectWithValidation ( t , server , opts )
557+ conn := connect ( t )
531558 defer conn .Close ()
532559
533560 // Do `replace`.
@@ -586,7 +613,7 @@ func TestUnflattenRows(t *testing.T) {
586613}
587614
588615func TestResultWithErr (t * testing.T ) {
589- conn := test_helpers . ConnectWithValidation ( t , server , opts )
616+ conn := connect ( t )
590617 defer conn .Close ()
591618
592619 for _ , testCase := range testResultWithErrCases {
@@ -601,7 +628,7 @@ func TestResultWithErr(t *testing.T) {
601628}
602629
603630func TestBoolResult (t * testing.T ) {
604- conn := test_helpers . ConnectWithValidation ( t , server , opts )
631+ conn := connect ( t )
605632 defer conn .Close ()
606633
607634 req := crud .MakeTruncateRequest (spaceName ).Opts (baseOpts )
@@ -624,7 +651,7 @@ func TestBoolResult(t *testing.T) {
624651}
625652
626653func TestNumberResult (t * testing.T ) {
627- conn := test_helpers . ConnectWithValidation ( t , server , opts )
654+ conn := connect ( t )
628655 defer conn .Close ()
629656
630657 req := crud .MakeCountRequest (spaceName ).Opts (countOpts )
@@ -665,7 +692,7 @@ func TestBaseResult(t *testing.T) {
665692 },
666693 }
667694
668- conn := test_helpers . ConnectWithValidation ( t , server , opts )
695+ conn := connect ( t )
669696 defer conn .Close ()
670697
671698 req := crud .MakeSelectRequest (spaceName ).Opts (selectOpts )
@@ -708,7 +735,7 @@ func TestManyResult(t *testing.T) {
708735 },
709736 }
710737
711- conn := test_helpers . ConnectWithValidation ( t , server , opts )
738+ conn := connect ( t )
712739 defer conn .Close ()
713740
714741 req := crud .MakeReplaceManyRequest (spaceName ).Tuples (tuples ).Opts (opManyOpts )
@@ -733,7 +760,7 @@ func TestManyResult(t *testing.T) {
733760}
734761
735762func TestStorageInfoResult (t * testing.T ) {
736- conn := test_helpers . ConnectWithValidation ( t , server , opts )
763+ conn := connect ( t )
737764 defer conn .Close ()
738765
739766 req := crud .MakeStorageInfoRequest ().Opts (baseOpts )
0 commit comments