summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2017-05-09 12:10:37 +0100
committerSean McGivern <sean@gitlab.com>2017-05-09 12:10:37 +0100
commit0251ef1c15ee9c3f3fc4298829ad9e1c07d767bd (patch)
tree16744ab2ce48d069937bceb1fb38205ea652d3c1
parenteb61b3b3aad9ff34d095a6ed2b5eda76170bef4f (diff)
downloadgitlab-ce-backport-pipelines-spec-fix.tar.gz
Enable RequestStore for pipelines controller N+1 specbackport-pipelines-spec-fix
EE performs a license check (which is cached in the RequestStore) as part of checking if a user can view a build. Using RequestStore gives a more accurate result of what will happen in production.
-rw-r--r--spec/controllers/projects/pipelines_controller_spec.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/controllers/projects/pipelines_controller_spec.rb b/spec/controllers/projects/pipelines_controller_spec.rb
index fb4a4721a58..244f47f4c90 100644
--- a/spec/controllers/projects/pipelines_controller_spec.rb
+++ b/spec/controllers/projects/pipelines_controller_spec.rb
@@ -50,6 +50,15 @@ describe Projects::PipelinesController do
end
context 'when the pipeline has multiple jobs' do
+ before do
+ RequestStore.begin!
+ end
+
+ after do
+ RequestStore.end!
+ RequestStore.clear!
+ end
+
it 'does not perform N + 1 queries' do
control_count = ActiveRecord::QueryRecorder.new { get_pipeline_json }.count