@@ -335,7 +335,6 @@ func TestStdoutStderr(t *testing.T) {
335
335
func TestTimeoutPlain (t * testing.T ) {
336
336
t .Parallel ()
337
337
338
- start := time .Now ()
339
338
command := & com.Command {
340
339
Binary : "bash" ,
341
340
// XXX unclear if windows is really able to terminate sleep 5, so, split it up to give it a
@@ -345,11 +344,10 @@ func TestTimeoutPlain(t *testing.T) {
345
344
}
346
345
347
346
err := command .Run (context .WithValue (context .Background (), com .LoggerKey , t ))
348
-
349
347
assertive .ErrorIsNil (t , err , "Err" )
350
348
349
+ start := time .Now ()
351
350
res , err := command .Wait ()
352
-
353
351
end := time .Now ()
354
352
355
353
assertive .ErrorIs (t , err , com .ErrTimeout , "Err" )
@@ -362,7 +360,6 @@ func TestTimeoutPlain(t *testing.T) {
362
360
func TestTimeoutDelayed (t * testing.T ) {
363
361
t .Parallel ()
364
362
365
- start := time .Now ()
366
363
command := & com.Command {
367
364
Binary : "bash" ,
368
365
// XXX unclear if windows is really able to terminate sleep 5, so, split it up to give it a
@@ -372,20 +369,18 @@ func TestTimeoutDelayed(t *testing.T) {
372
369
}
373
370
374
371
err := command .Run (context .WithValue (context .Background (), com .LoggerKey , t ))
375
-
376
372
assertive .ErrorIsNil (t , err , "Err" )
377
373
378
- time . Sleep ( 1 * time .Second )
379
-
374
+ start := time .Now ( )
375
+ time . Sleep ( 2 * time . Second )
380
376
res , err := command .Wait ()
381
-
382
377
end := time .Now ()
383
378
384
379
assertive .ErrorIs (t , err , com .ErrTimeout , "Err" )
385
380
assertive .IsEqual (t , res .ExitCode , - 1 , "ExitCode" )
386
381
assertive .IsEqual (t , res .Stdout , "one" , "Stdout" )
387
382
assertive .IsEqual (t , res .Stderr , "" , "Stderr" )
388
- assertive .IsLessThan (t , end .Sub (start ), 2 * time .Second , "Total execution time" )
383
+ assertive .IsLessThan (t , end .Sub (start ), 3 * time .Second , "Total execution time" )
389
384
}
390
385
391
386
func TestPTYStdout (t * testing.T ) {
0 commit comments