Skip to content

Exit RSpec early when PG::QueryCanceled happens

David Dieulivol requested to merge ddieulivol-mitigate_pg_errors_in_ci into master

Context

This MR is to mitigate the impact of #402915 (closed) on the pipelines duration.

What does this MR do and why?

Exit RSpec early when a specs fails because an exception related to PG::QueryCanceled happens.

We don't check for the PG::QueryCanceled directly, because it is generally wrapped up in another exception. For instance in https://gitlab.com/gitlab-org/gitlab/-/jobs/4518566961, we see the following errors:

#<ActionView::Template::Error: PG::QueryCanceled: ERROR:  canceling statement due to statement timeout
#<ActiveRecord::QueryCanceled: PG::QueryCanceled: ERROR:  canceling statement due to statement timeout

I've seen others wrapped in Grape exceptions.

Does it work?

In !124438 (2e8d0892), I'm raising an error similar to the ones we see in failing jobs (e.g. an wrapper error that contains a message about QueryCanceled).

The job failed after 4min 🎉

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by David Dieulivol

Merge request reports