@@ -315,27 +315,31 @@ func RequiredFixtureMissing(name string) error {
315
315
func TimeoutConflict (
316
316
ti * Timings ,
317
317
) error {
318
- gotestDeadline := ti .GoTestTimeout
318
+ goTestTimeout := ti .GoTestTimeout
319
319
totalWait := ti .TotalWait
320
320
maxTimeout := ti .MaxTimeout
321
321
msg := fmt .Sprintf (
322
322
"go test -timeout value of %s " ,
323
- (gotestDeadline + time .Second ).Round (time .Second ),
323
+ (goTestTimeout + time .Second ).Round (time .Second ),
324
324
)
325
325
if totalWait > 0 {
326
- msg += fmt .Sprintf (
327
- "is shorter than the total wait time in the scenario: %s. " +
328
- "either decrease the wait times or increase the " +
329
- "go test -timeout value." ,
330
- totalWait .Round (time .Second ),
331
- )
326
+ if totalWait .Abs () > goTestTimeout .Abs () {
327
+ msg += fmt .Sprintf (
328
+ "is shorter than the total wait time in the scenario: %s. " +
329
+ "either decrease the wait times or increase the " +
330
+ "go test -timeout value." ,
331
+ totalWait .Round (time .Second ),
332
+ )
333
+ }
332
334
} else {
333
- msg += fmt .Sprintf (
334
- "is shorter than the maximum timeout specified in the " +
335
- "scenario: %s. either decrease the scenario or spec " +
336
- "timeout or increase the go test -timeout value." ,
337
- maxTimeout .Round (time .Second ),
338
- )
335
+ if maxTimeout .Abs () > goTestTimeout .Abs () {
336
+ msg += fmt .Sprintf (
337
+ "is shorter than the maximum timeout specified in the " +
338
+ "scenario: %s. either decrease the scenario or spec " +
339
+ "timeout or increase the go test -timeout value." ,
340
+ maxTimeout .Round (time .Second ),
341
+ )
342
+ }
339
343
}
340
344
return fmt .Errorf ("%w: %s" , ErrTimeoutConflict , msg )
341
345
}
0 commit comments