Skip to content

Commit

Permalink
fix: Better logging for timed out jobs (#857)
Browse files Browse the repository at this point in the history
* Make sure timed out jobs are not reported to Insights

* Handle timed out jobs when logging final suite results

* whitespace cleanup

* timeout logging should be error level

* Reverse the condition

For clarity
  • Loading branch information
mhan83 authored Nov 22, 2023
1 parent 1f5fa8b commit f6b25b7
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions internal/saucecloud/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,15 @@ func (r *CloudRunner) collectResults(artifactCfg config.ArtifactDownload, result
}
r.logSuite(res)

// Skip reporting to Insights for async job
if r.Async {
continue
// NOTE: Jobs must be finished in order to be reported to Insights.
// * Async jobs have an unknown status by definition, so should always be excluded from reporting.
// * Timed out jobs will be requested to stop, but stopping a job
// is either not possible (rdc) or async (vdc) so its actual status is not known now.
// Skip reporting to be safe.
isFinished := !r.Async && !res.job.TimedOut
if isFinished {
r.reportSuiteToInsights(res)
}
// Report suite to Insights
r.reportSuiteToInsights(res)
}
close(done)

Expand Down Expand Up @@ -691,6 +694,12 @@ func (r *CloudRunner) logSuite(res result) {
}

jobDetailsPage := fmt.Sprintf("%s/tests/%s", r.Region.AppBaseURL(), res.job.ID)

if res.job.TimedOut {
log.Error().Str("suite", res.name).Str("url", jobDetailsPage).Msg("Suite timed out.")
return
}

msg := "Suite finished."
if res.job.Passed {
log.Info().Str("suite", res.name).Bool("passed", res.job.Passed).Str("url", jobDetailsPage).
Expand Down

0 comments on commit f6b25b7

Please sign in to comment.