@@ -108,7 +108,7 @@ func testGracefulShutdown(t *testing.T, conn *Connection, inst *test_helpers.Tar
108
108
// Wait until server go down.
109
109
// Server will go down only when it process all requests from our connection
110
110
// (or on timeout).
111
- _ , err = inst . Cmd . Process .Wait ()
111
+ err = inst .Wait ()
112
112
require .Nil (t , err )
113
113
shutdownFinish := time .Now ()
114
114
shutdownTime := shutdownFinish .Sub (shutdownStart )
@@ -129,18 +129,16 @@ func testGracefulShutdown(t *testing.T, conn *Connection, inst *test_helpers.Tar
129
129
func TestGracefulShutdown (t * testing.T ) {
130
130
test_helpers .SkipIfWatchersUnsupported (t )
131
131
132
- var inst test_helpers.TarantoolInstance
133
132
var conn * Connection
134
- var err error
135
133
136
- inst , err = test_helpers .StartTarantool (shtdnSrvOpts )
134
+ inst , err : = test_helpers .StartTarantool (shtdnSrvOpts )
137
135
require .Nil (t , err )
138
136
defer test_helpers .StopTarantoolWithCleanup (inst )
139
137
140
138
conn = test_helpers .ConnectWithValidation (t , shtdnDialer , shtdnClntOpts )
141
139
defer conn .Close ()
142
140
143
- testGracefulShutdown (t , conn , & inst )
141
+ testGracefulShutdown (t , conn , inst )
144
142
}
145
143
146
144
func TestCloseGraceful (t * testing.T ) {
@@ -190,26 +188,23 @@ func TestCloseGraceful(t *testing.T) {
190
188
func TestGracefulShutdownWithReconnect (t * testing.T ) {
191
189
test_helpers .SkipIfWatchersUnsupported (t )
192
190
193
- var inst test_helpers.TarantoolInstance
194
- var err error
195
-
196
- inst , err = test_helpers .StartTarantool (shtdnSrvOpts )
191
+ inst , err := test_helpers .StartTarantool (shtdnSrvOpts )
197
192
require .Nil (t , err )
198
193
defer test_helpers .StopTarantoolWithCleanup (inst )
199
194
200
195
conn := test_helpers .ConnectWithValidation (t , shtdnDialer , shtdnClntOpts )
201
196
defer conn .Close ()
202
197
203
- testGracefulShutdown (t , conn , & inst )
198
+ testGracefulShutdown (t , conn , inst )
204
199
205
- err = test_helpers .RestartTarantool (& inst )
200
+ err = test_helpers .RestartTarantool (inst )
206
201
require .Nilf (t , err , "Failed to restart tarantool" )
207
202
208
203
connected := test_helpers .WaitUntilReconnected (conn , shtdnClntOpts .MaxReconnects ,
209
204
shtdnClntOpts .Reconnect )
210
205
require .Truef (t , connected , "Reconnect success" )
211
206
212
- testGracefulShutdown (t , conn , & inst )
207
+ testGracefulShutdown (t , conn , inst )
213
208
}
214
209
215
210
func TestNoGracefulShutdown (t * testing.T ) {
@@ -219,14 +214,12 @@ func TestNoGracefulShutdown(t *testing.T) {
219
214
noShtdDialer .RequiredProtocolInfo = ProtocolInfo {}
220
215
test_helpers .SkipIfWatchersSupported (t )
221
216
222
- var inst test_helpers.TarantoolInstance
223
217
var conn * Connection
224
- var err error
225
218
226
219
testSrvOpts := shtdnSrvOpts
227
220
testSrvOpts .Dialer = noShtdDialer
228
221
229
- inst , err = test_helpers .StartTarantool (testSrvOpts )
222
+ inst , err : = test_helpers .StartTarantool (testSrvOpts )
230
223
require .Nil (t , err )
231
224
defer test_helpers .StopTarantoolWithCleanup (inst )
232
225
@@ -256,7 +249,7 @@ func TestNoGracefulShutdown(t *testing.T) {
256
249
require .NotNilf (t , err , "sleep request error" )
257
250
258
251
// Wait until server go down.
259
- _ , err = inst . Cmd . Process .Wait ()
252
+ err = inst .Wait ()
260
253
require .Nil (t , err )
261
254
shutdownFinish := time .Now ()
262
255
shutdownTime := shutdownFinish .Sub (shutdownStart )
@@ -274,11 +267,9 @@ func TestNoGracefulShutdown(t *testing.T) {
274
267
func TestGracefulShutdownRespectsClose (t * testing.T ) {
275
268
test_helpers .SkipIfWatchersUnsupported (t )
276
269
277
- var inst test_helpers.TarantoolInstance
278
270
var conn * Connection
279
- var err error
280
271
281
- inst , err = test_helpers .StartTarantool (shtdnSrvOpts )
272
+ inst , err : = test_helpers .StartTarantool (shtdnSrvOpts )
282
273
require .Nil (t , err )
283
274
defer test_helpers .StopTarantoolWithCleanup (inst )
284
275
@@ -327,7 +318,7 @@ func TestGracefulShutdownRespectsClose(t *testing.T) {
327
318
require .NotNilf (t , err , "sleep request error" )
328
319
329
320
// Wait until server go down.
330
- _ , err = inst . Cmd . Process .Wait ()
321
+ err = inst .Wait ()
331
322
require .Nil (t , err )
332
323
shutdownFinish := time .Now ()
333
324
shutdownTime := shutdownFinish .Sub (shutdownStart )
@@ -354,11 +345,9 @@ func TestGracefulShutdownRespectsClose(t *testing.T) {
354
345
func TestGracefulShutdownNotRacesWithRequestReconnect (t * testing.T ) {
355
346
test_helpers .SkipIfWatchersUnsupported (t )
356
347
357
- var inst test_helpers.TarantoolInstance
358
348
var conn * Connection
359
- var err error
360
349
361
- inst , err = test_helpers .StartTarantool (shtdnSrvOpts )
350
+ inst , err : = test_helpers .StartTarantool (shtdnSrvOpts )
362
351
require .Nil (t , err )
363
352
defer test_helpers .StopTarantoolWithCleanup (inst )
364
353
@@ -401,7 +390,7 @@ func TestGracefulShutdownNotRacesWithRequestReconnect(t *testing.T) {
401
390
402
391
// Wait until server go down.
403
392
// Server is expected to go down on timeout.
404
- _ , err = inst . Cmd . Process .Wait ()
393
+ err = inst .Wait ()
405
394
require .Nil (t , err )
406
395
407
396
// Help test helpers to properly clean up.
@@ -425,11 +414,9 @@ func TestGracefulShutdownNotRacesWithRequestReconnect(t *testing.T) {
425
414
func TestGracefulShutdownCloseConcurrent (t * testing.T ) {
426
415
test_helpers .SkipIfWatchersUnsupported (t )
427
416
428
- var inst test_helpers.TarantoolInstance
429
- var err error
430
417
var srvShtdnStart , srvShtdnFinish time.Time
431
418
432
- inst , err = test_helpers .StartTarantool (shtdnSrvOpts )
419
+ inst , err : = test_helpers .StartTarantool (shtdnSrvOpts )
433
420
require .Nil (t , err )
434
421
defer test_helpers .StopTarantoolWithCleanup (inst )
435
422
@@ -492,12 +479,12 @@ func TestGracefulShutdownCloseConcurrent(t *testing.T) {
492
479
sret = cerr
493
480
}
494
481
srvStop .Done ()
495
- }(& inst )
482
+ }(inst )
496
483
497
484
srvStop .Wait ()
498
485
require .Nil (t , sret , "No errors on server SIGTERM" )
499
486
500
- _ , err = inst . Cmd . Process .Wait ()
487
+ err = inst .Wait ()
501
488
require .Nil (t , err )
502
489
503
490
// Help test helpers to properly clean up.
@@ -515,11 +502,9 @@ func TestGracefulShutdownCloseConcurrent(t *testing.T) {
515
502
func TestGracefulShutdownConcurrent (t * testing.T ) {
516
503
test_helpers .SkipIfWatchersUnsupported (t )
517
504
518
- var inst test_helpers.TarantoolInstance
519
- var err error
520
505
var srvShtdnStart , srvShtdnFinish time.Time
521
506
522
- inst , err = test_helpers .StartTarantool (shtdnSrvOpts )
507
+ inst , err : = test_helpers .StartTarantool (shtdnSrvOpts )
523
508
require .Nil (t , err )
524
509
defer test_helpers .StopTarantoolWithCleanup (inst )
525
510
@@ -582,15 +567,15 @@ func TestGracefulShutdownConcurrent(t *testing.T) {
582
567
sret = cerr
583
568
}
584
569
srvStop .Done ()
585
- }(& inst )
570
+ }(inst )
586
571
587
572
srvStop .Wait ()
588
573
require .Nil (t , sret , "No errors on server SIGTERM" )
589
574
590
575
caseWg .Wait ()
591
576
require .Nil (t , ret , "No errors on concurrent wait" )
592
577
593
- _ , err = inst . Cmd . Process .Wait ()
578
+ err = inst .Wait ()
594
579
require .Nil (t , err )
595
580
596
581
// Help test helpers to properly clean up.
0 commit comments