Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix TimeoutConflict error message #48

Merged
merged 1 commit into from
Jul 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}
Loading