@@ -411,7 +411,6 @@ func TestStdoutStderr(t *testing.T) {
411
411
func TestTimeoutPlain (t * testing.T ) {
412
412
t .Parallel ()
413
413
414
- start := time .Now ()
415
414
command := & com.Command {
416
415
Binary : "bash" ,
417
416
// XXX unclear if windows is really able to terminate sleep 5, so, split it up to give it a
@@ -421,11 +420,10 @@ func TestTimeoutPlain(t *testing.T) {
421
420
}
422
421
423
422
err := command .Run (context .WithValue (context .Background (), com .LoggerKey , t ))
424
-
425
423
assertive .ErrorIsNil (t , err , "Err" )
426
424
425
+ start := time .Now ()
427
426
res , err := command .Wait ()
428
-
429
427
end := time .Now ()
430
428
431
429
assertive .ErrorIs (t , err , com .ErrTimeout , "Err" )
@@ -438,7 +436,6 @@ func TestTimeoutPlain(t *testing.T) {
438
436
func TestTimeoutDelayed (t * testing.T ) {
439
437
t .Parallel ()
440
438
441
- start := time .Now ()
442
439
command := & com.Command {
443
440
Binary : "bash" ,
444
441
// XXX unclear if windows is really able to terminate sleep 5, so, split it up to give it a
@@ -448,20 +445,20 @@ func TestTimeoutDelayed(t *testing.T) {
448
445
}
449
446
450
447
err := command .Run (context .WithValue (context .Background (), com .LoggerKey , t ))
451
-
452
448
assertive .ErrorIsNil (t , err , "Err" )
453
449
454
- time . Sleep ( 1 * time .Second )
450
+ start := time .Now ( )
455
451
456
- res , err := command . Wait ( )
452
+ time . Sleep ( 2 * time . Second )
457
453
454
+ res , err := command .Wait ()
458
455
end := time .Now ()
459
456
460
457
assertive .ErrorIs (t , err , com .ErrTimeout , "Err" )
461
458
assertive .IsEqual (t , res .ExitCode , - 1 , "ExitCode" )
462
459
assertive .IsEqual (t , res .Stdout , "one" , "Stdout" )
463
460
assertive .IsEqual (t , res .Stderr , "" , "Stderr" )
464
- assertive .IsLessThan (t , end .Sub (start ), 2 * time .Second , "Total execution time" )
461
+ assertive .IsLessThan (t , end .Sub (start ), 3 * time .Second , "Total execution time" )
465
462
}
466
463
467
464
func TestPTYStdout (t * testing.T ) {
0 commit comments