diff options
author | Michael Kozono <mkozono@gmail.com> | 2018-09-25 13:19:40 -0700 |
---|---|---|
committer | Michael Kozono <mkozono@gmail.com> | 2018-09-25 13:24:37 -0700 |
commit | b720ea0613c1ce8db48f300a6d685f74acb9b9bf (patch) | |
tree | a2bdd53dfc259e2d10dae88c6c646350793e89d6 | |
parent | 0920342094ae07d7225b42cf23cf9637076d2b25 (diff) | |
download | gitlab-ce-b720ea0613c1ce8db48f300a6d685f74acb9b9bf.tar.gz |
Fix RequestStore-related test failuremk/backport-fix-safe-request-store-test
The test was failing
https://gitlab.com/gitlab-org/gitlab-ee/-/jobs/101444126 because
https://gitlab.com/gitlab-org/gitlab-ee/blob/a04056efad6639420b469eced5130751a8cf2757/ee/spec/support/request_store.rb
which is in EE only, clears the RequestStore before every test,
regardless of whether RequestStore is active. This test is unusual
because it sets up RequestStore without it being active, to make sure
that the tested code doesn’t attempt to use RequestStore. These two
unusual facts combined to cause the failure in EE only. The fix works
because of the particular order of RSpec hooks in the test lifecycle.
-rw-r--r-- | spec/lib/gitlab/safe_request_store_spec.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/spec/lib/gitlab/safe_request_store_spec.rb b/spec/lib/gitlab/safe_request_store_spec.rb index 27766fa0eda..c797171dbe2 100644 --- a/spec/lib/gitlab/safe_request_store_spec.rb +++ b/spec/lib/gitlab/safe_request_store_spec.rb @@ -219,11 +219,11 @@ describe Gitlab::SafeRequestStore do end context 'when RequestStore is NOT active' do - around do |example| + before do RequestStore.write('foo', true) + end - example.run - + after do RequestStore.clear! # Clean up end |