From 7f0aae3e9c4d3c6e340adc653068dc8d63791fee Mon Sep 17 00:00:00 2001 From: Mike Han <56001373+mhan83@users.noreply.github.com> Date: Wed, 27 Nov 2024 21:18:40 -0700 Subject: [PATCH] fix: Make sure job errors are always printed (#985) --- internal/saucecloud/cloud.go | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/internal/saucecloud/cloud.go b/internal/saucecloud/cloud.go index 6cbe7530c..a1fd1c414 100644 --- a/internal/saucecloud/cloud.go +++ b/internal/saucecloud/cloud.go @@ -788,25 +788,30 @@ func (r *CloudRunner) isFileStored(filename string) (storageID string, err error // logSuite display the result of a suite func (r *CloudRunner) logSuite(res result) { - // Job isn't done, hence nothing more to log about it. - if !job.Done(res.job.Status) || r.Async { - return - } - logger := log.With(). Str("suite", res.name). Bool("passed", res.job.Passed). Str("url", res.job.URL). Logger() - if res.skipped { - logger.Error().Err(res.err).Msg("Suite skipped.") + if res.err != nil { + if res.skipped { + logger.Error().Err(res.err).Msg("Suite skipped.") + return + } + if res.job.ID == "" { + logger.Error().Err(res.err).Msg("Suite failed to start.") + return + } + logger.Error().Err(res.err).Msg("Suite failed unexpectedly.") return } - if res.job.ID == "" { - logger.Error().Err(res.err).Msg("Suite failed to start.") + + // Job isn't done, hence nothing more to log about it. + if !job.Done(res.job.Status) || r.Async { return } + if res.job.TimedOut { logger.Error().Msg("Suite timed out.") return