@@ -78,7 +78,7 @@ func testGracefulShutdown(t *testing.T, conn *Connection, inst *test_helpers.Tar
7878
7979 // SIGTERM the server.
8080 shutdownStart := time .Now ()
81- require .Nil (t , inst .Cmd . Process . Signal (syscall .SIGTERM ))
81+ require .Nil (t , inst .Signal (syscall .SIGTERM ))
8282
8383 // Check that we can't send new requests after shutdown starts.
8484 // Retry helps to wait a bit until server starts to shutdown
@@ -108,14 +108,11 @@ func testGracefulShutdown(t *testing.T, conn *Connection, inst *test_helpers.Tar
108108 // Wait until server go down.
109109 // Server will go down only when it process all requests from our connection
110110 // (or on timeout).
111- _ , err = inst . Cmd . Process .Wait ()
111+ err = inst .Wait ()
112112 require .Nil (t , err )
113113 shutdownFinish := time .Now ()
114114 shutdownTime := shutdownFinish .Sub (shutdownStart )
115115
116- // Help test helpers to properly clean up.
117- inst .Cmd .Process = nil
118-
119116 // Check that it wasn't a timeout.
120117 require .Lessf (t ,
121118 shutdownTime ,
@@ -129,18 +126,16 @@ func testGracefulShutdown(t *testing.T, conn *Connection, inst *test_helpers.Tar
129126func TestGracefulShutdown (t * testing.T ) {
130127 test_helpers .SkipIfWatchersUnsupported (t )
131128
132- var inst test_helpers.TarantoolInstance
133129 var conn * Connection
134- var err error
135130
136- inst , err = test_helpers .StartTarantool (shtdnSrvOpts )
131+ inst , err : = test_helpers .StartTarantool (shtdnSrvOpts )
137132 require .Nil (t , err )
138133 defer test_helpers .StopTarantoolWithCleanup (inst )
139134
140135 conn = test_helpers .ConnectWithValidation (t , shtdnDialer , shtdnClntOpts )
141136 defer conn .Close ()
142137
143- testGracefulShutdown (t , conn , & inst )
138+ testGracefulShutdown (t , conn , inst )
144139}
145140
146141func TestCloseGraceful (t * testing.T ) {
@@ -190,26 +185,23 @@ func TestCloseGraceful(t *testing.T) {
190185func TestGracefulShutdownWithReconnect (t * testing.T ) {
191186 test_helpers .SkipIfWatchersUnsupported (t )
192187
193- var inst test_helpers.TarantoolInstance
194- var err error
195-
196- inst , err = test_helpers .StartTarantool (shtdnSrvOpts )
188+ inst , err := test_helpers .StartTarantool (shtdnSrvOpts )
197189 require .Nil (t , err )
198190 defer test_helpers .StopTarantoolWithCleanup (inst )
199191
200192 conn := test_helpers .ConnectWithValidation (t , shtdnDialer , shtdnClntOpts )
201193 defer conn .Close ()
202194
203- testGracefulShutdown (t , conn , & inst )
195+ testGracefulShutdown (t , conn , inst )
204196
205- err = test_helpers .RestartTarantool (& inst )
197+ err = test_helpers .RestartTarantool (inst )
206198 require .Nilf (t , err , "Failed to restart tarantool" )
207199
208200 connected := test_helpers .WaitUntilReconnected (conn , shtdnClntOpts .MaxReconnects ,
209201 shtdnClntOpts .Reconnect )
210202 require .Truef (t , connected , "Reconnect success" )
211203
212- testGracefulShutdown (t , conn , & inst )
204+ testGracefulShutdown (t , conn , inst )
213205}
214206
215207func TestNoGracefulShutdown (t * testing.T ) {
@@ -219,14 +211,12 @@ func TestNoGracefulShutdown(t *testing.T) {
219211 noShtdDialer .RequiredProtocolInfo = ProtocolInfo {}
220212 test_helpers .SkipIfWatchersSupported (t )
221213
222- var inst test_helpers.TarantoolInstance
223214 var conn * Connection
224- var err error
225215
226216 testSrvOpts := shtdnSrvOpts
227217 testSrvOpts .Dialer = noShtdDialer
228218
229- inst , err = test_helpers .StartTarantool (testSrvOpts )
219+ inst , err : = test_helpers .StartTarantool (testSrvOpts )
230220 require .Nil (t , err )
231221 defer test_helpers .StopTarantoolWithCleanup (inst )
232222
@@ -249,21 +239,18 @@ func TestNoGracefulShutdown(t *testing.T) {
249239
250240 // SIGTERM the server.
251241 shutdownStart := time .Now ()
252- require .Nil (t , inst .Cmd . Process . Signal (syscall .SIGTERM ))
242+ require .Nil (t , inst .Signal (syscall .SIGTERM ))
253243
254244 // Check that request was interrupted.
255245 _ , err = fut .Get ()
256246 require .NotNilf (t , err , "sleep request error" )
257247
258248 // Wait until server go down.
259- _ , err = inst . Cmd . Process .Wait ()
249+ err = inst .Wait ()
260250 require .Nil (t , err )
261251 shutdownFinish := time .Now ()
262252 shutdownTime := shutdownFinish .Sub (shutdownStart )
263253
264- // Help test helpers to properly clean up.
265- inst .Cmd .Process = nil
266-
267254 // Check that server finished without waiting for eval to finish.
268255 require .Lessf (t ,
269256 shutdownTime ,
@@ -274,11 +261,9 @@ func TestNoGracefulShutdown(t *testing.T) {
274261func TestGracefulShutdownRespectsClose (t * testing.T ) {
275262 test_helpers .SkipIfWatchersUnsupported (t )
276263
277- var inst test_helpers.TarantoolInstance
278264 var conn * Connection
279- var err error
280265
281- inst , err = test_helpers .StartTarantool (shtdnSrvOpts )
266+ inst , err : = test_helpers .StartTarantool (shtdnSrvOpts )
282267 require .Nil (t , err )
283268 defer test_helpers .StopTarantoolWithCleanup (inst )
284269
@@ -314,7 +299,7 @@ func TestGracefulShutdownRespectsClose(t *testing.T) {
314299
315300 // SIGTERM the server.
316301 shutdownStart := time .Now ()
317- require .Nil (t , inst .Cmd . Process . Signal (syscall .SIGTERM ))
302+ require .Nil (t , inst .Signal (syscall .SIGTERM ))
318303
319304 // Close the connection.
320305 conn .Close ()
@@ -327,14 +312,11 @@ func TestGracefulShutdownRespectsClose(t *testing.T) {
327312 require .NotNilf (t , err , "sleep request error" )
328313
329314 // Wait until server go down.
330- _ , err = inst . Cmd . Process .Wait ()
315+ err = inst .Wait ()
331316 require .Nil (t , err )
332317 shutdownFinish := time .Now ()
333318 shutdownTime := shutdownFinish .Sub (shutdownStart )
334319
335- // Help test helpers to properly clean up.
336- inst .Cmd .Process = nil
337-
338320 // Check that server finished without waiting for eval to finish.
339321 require .Lessf (t ,
340322 shutdownTime ,
@@ -354,11 +336,9 @@ func TestGracefulShutdownRespectsClose(t *testing.T) {
354336func TestGracefulShutdownNotRacesWithRequestReconnect (t * testing.T ) {
355337 test_helpers .SkipIfWatchersUnsupported (t )
356338
357- var inst test_helpers.TarantoolInstance
358339 var conn * Connection
359- var err error
360340
361- inst , err = test_helpers .StartTarantool (shtdnSrvOpts )
341+ inst , err : = test_helpers .StartTarantool (shtdnSrvOpts )
362342 require .Nil (t , err )
363343 defer test_helpers .StopTarantoolWithCleanup (inst )
364344
@@ -397,16 +377,13 @@ func TestGracefulShutdownNotRacesWithRequestReconnect(t *testing.T) {
397377 fut := conn .Do (req )
398378
399379 // SIGTERM the server.
400- require .Nil (t , inst .Cmd . Process . Signal (syscall .SIGTERM ))
380+ require .Nil (t , inst .Signal (syscall .SIGTERM ))
401381
402382 // Wait until server go down.
403383 // Server is expected to go down on timeout.
404- _ , err = inst . Cmd . Process .Wait ()
384+ err = inst .Wait ()
405385 require .Nil (t , err )
406386
407- // Help test helpers to properly clean up.
408- inst .Cmd .Process = nil
409-
410387 // Check that request failed by server disconnect, not a client timeout.
411388 _ , err = fut .Get ()
412389 require .NotNil (t , err )
@@ -425,11 +402,9 @@ func TestGracefulShutdownNotRacesWithRequestReconnect(t *testing.T) {
425402func TestGracefulShutdownCloseConcurrent (t * testing.T ) {
426403 test_helpers .SkipIfWatchersUnsupported (t )
427404
428- var inst test_helpers.TarantoolInstance
429- var err error
430405 var srvShtdnStart , srvShtdnFinish time.Time
431406
432- inst , err = test_helpers .StartTarantool (shtdnSrvOpts )
407+ inst , err : = test_helpers .StartTarantool (shtdnSrvOpts )
433408 require .Nil (t , err )
434409 defer test_helpers .StopTarantoolWithCleanup (inst )
435410
@@ -487,22 +462,19 @@ func TestGracefulShutdownCloseConcurrent(t *testing.T) {
487462 go func (inst * test_helpers.TarantoolInstance ) {
488463 srvToStop .Wait ()
489464 srvShtdnStart = time .Now ()
490- cerr := inst .Cmd . Process . Signal (syscall .SIGTERM )
465+ cerr := inst .Signal (syscall .SIGTERM )
491466 if cerr != nil {
492467 sret = cerr
493468 }
494469 srvStop .Done ()
495- }(& inst )
470+ }(inst )
496471
497472 srvStop .Wait ()
498473 require .Nil (t , sret , "No errors on server SIGTERM" )
499474
500- _ , err = inst . Cmd . Process .Wait ()
475+ err = inst .Wait ()
501476 require .Nil (t , err )
502477
503- // Help test helpers to properly clean up.
504- inst .Cmd .Process = nil
505-
506478 srvShtdnFinish = time .Now ()
507479 srvShtdnTime := srvShtdnFinish .Sub (srvShtdnStart )
508480
@@ -515,11 +487,9 @@ func TestGracefulShutdownCloseConcurrent(t *testing.T) {
515487func TestGracefulShutdownConcurrent (t * testing.T ) {
516488 test_helpers .SkipIfWatchersUnsupported (t )
517489
518- var inst test_helpers.TarantoolInstance
519- var err error
520490 var srvShtdnStart , srvShtdnFinish time.Time
521491
522- inst , err = test_helpers .StartTarantool (shtdnSrvOpts )
492+ inst , err : = test_helpers .StartTarantool (shtdnSrvOpts )
523493 require .Nil (t , err )
524494 defer test_helpers .StopTarantoolWithCleanup (inst )
525495
@@ -577,25 +547,22 @@ func TestGracefulShutdownConcurrent(t *testing.T) {
577547 go func (inst * test_helpers.TarantoolInstance ) {
578548 srvToStop .Wait ()
579549 srvShtdnStart = time .Now ()
580- cerr := inst .Cmd . Process . Signal (syscall .SIGTERM )
550+ cerr := inst .Signal (syscall .SIGTERM )
581551 if cerr != nil {
582552 sret = cerr
583553 }
584554 srvStop .Done ()
585- }(& inst )
555+ }(inst )
586556
587557 srvStop .Wait ()
588558 require .Nil (t , sret , "No errors on server SIGTERM" )
589559
590560 caseWg .Wait ()
591561 require .Nil (t , ret , "No errors on concurrent wait" )
592562
593- _ , err = inst . Cmd . Process .Wait ()
563+ err = inst .Wait ()
594564 require .Nil (t , err )
595565
596- // Help test helpers to properly clean up.
597- inst .Cmd .Process = nil
598-
599566 srvShtdnFinish = time .Now ()
600567 srvShtdnTime := srvShtdnFinish .Sub (srvShtdnStart )
601568
0 commit comments