Skip to content

Commit

Permalink
Merge pull request #48 from jaypipes/timeout-conflict
Browse files Browse the repository at this point in the history
fix TimeoutConflict error message
  • Loading branch information
jaypipes authored Jul 8, 2024
2 parents b2b65f2 + a21aaf4 commit abdb914
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions api/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,27 +315,31 @@ func RequiredFixtureMissing(name string) error {
func TimeoutConflict(
ti *Timings,
) error {
gotestDeadline := ti.GoTestTimeout
goTestTimeout := ti.GoTestTimeout
totalWait := ti.TotalWait
maxTimeout := ti.MaxTimeout
msg := fmt.Sprintf(
"go test -timeout value of %s ",
(gotestDeadline + time.Second).Round(time.Second),
(goTestTimeout + time.Second).Round(time.Second),
)
if totalWait > 0 {
msg += fmt.Sprintf(
"is shorter than the total wait time in the scenario: %s. "+
"either decrease the wait times or increase the "+
"go test -timeout value.",
totalWait.Round(time.Second),
)
if totalWait.Abs() > goTestTimeout.Abs() {
msg += fmt.Sprintf(
"is shorter than the total wait time in the scenario: %s. "+
"either decrease the wait times or increase the "+
"go test -timeout value.",
totalWait.Round(time.Second),
)
}
} else {
msg += fmt.Sprintf(
"is shorter than the maximum timeout specified in the "+
"scenario: %s. either decrease the scenario or spec "+
"timeout or increase the go test -timeout value.",
maxTimeout.Round(time.Second),
)
if maxTimeout.Abs() > goTestTimeout.Abs() {
msg += fmt.Sprintf(
"is shorter than the maximum timeout specified in the "+
"scenario: %s. either decrease the scenario or spec "+
"timeout or increase the go test -timeout value.",
maxTimeout.Round(time.Second),
)
}
}
return fmt.Errorf("%w: %s", ErrTimeoutConflict, msg)
}

0 comments on commit abdb914

Please sign in to comment.