@@ -411,7 +411,6 @@ func TestStdoutStderr(t *testing.T) {
411411func TestTimeoutPlain (t * testing.T ) {
412412 t .Parallel ()
413413
414- start := time .Now ()
415414 command := & com.Command {
416415 Binary : "bash" ,
417416 // 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) {
421420 }
422421
423422 err := command .Run (context .WithValue (context .Background (), com .LoggerKey , t ))
424-
425423 assertive .ErrorIsNil (t , err , "Err" )
426424
425+ start := time .Now ()
427426 res , err := command .Wait ()
428-
429427 end := time .Now ()
430428
431429 assertive .ErrorIs (t , err , com .ErrTimeout , "Err" )
@@ -438,7 +436,6 @@ func TestTimeoutPlain(t *testing.T) {
438436func TestTimeoutDelayed (t * testing.T ) {
439437 t .Parallel ()
440438
441- start := time .Now ()
442439 command := & com.Command {
443440 Binary : "bash" ,
444441 // 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) {
448445 }
449446
450447 err := command .Run (context .WithValue (context .Background (), com .LoggerKey , t ))
451-
452448 assertive .ErrorIsNil (t , err , "Err" )
453449
454- time . Sleep ( 1 * time .Second )
450+ start := time .Now ( )
455451
456- res , err := command . Wait ( )
452+ time . Sleep ( 2 * time . Second )
457453
454+ res , err := command .Wait ()
458455 end := time .Now ()
459456
460457 assertive .ErrorIs (t , err , com .ErrTimeout , "Err" )
461458 assertive .IsEqual (t , res .ExitCode , - 1 , "ExitCode" )
462459 assertive .IsEqual (t , res .Stdout , "one" , "Stdout" )
463460 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" )
465462}
466463
467464func TestPTYStdout (t * testing.T ) {
0 commit comments