Skip to content

Prevent warden errors in session middleware

Heinrich Lee Yu requested to merge fix-flaky-spec-session-middleware into master

What does this MR do and why?

Ignore warden errors in UnauthenticatedSessionExpiry middleware. We don't need to handle these errors since we're just interested in whether a session is authenticated or not so we can set the correct expiry time.

This caused flaky specs as seen in gitlab-org/quality/engineering-productivity/master-broken-incidents#4891 (closed)

Related to #437284 (closed)

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

The flaky failure can be reproduced by applying this diff:

diff --git a/spec/features/issues/issue_detail_spec.rb b/spec/features/issues/issue_detail_spec.rb
index 15cb1678c552..35dd84a3531d 100644
--- a/spec/features/issues/issue_detail_spec.rb
+++ b/spec/features/issues/issue_detail_spec.rb
@@ -109,6 +109,8 @@

       Users::DestroyService.new(user_to_be_deleted).execute(user_to_be_deleted)

+      sleep 3
+
       sign_in(user)
       visit project_issue_path(project, issue)
     end

Then running:

bin/rspec ./spec/features/issues/issue_detail_spec.rb:116

The failure happens because after the user is deleted, the ActionCable request on the current page with deleted user signed in will fail with the 500. Without the sleep, sometimes the spec is fast enough to load the next page that the 500 does not happen.

Edited by Heinrich Lee Yu

Merge request reports