Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorThong Kuah <tkuah@gitlab.com>2019-06-28 11:14:09 +0300
committerThong Kuah <tkuah@gitlab.com>2019-06-28 11:14:09 +0300
commitd69f9af7cf4d208a87379a211ff63fc7f1e5fce4 (patch)
treeeb808417379c5b35b49b11a108b7b5d37087866f /spec
parentb0845b6293cc31f29583116ab583e77aad6a892f (diff)
parent04d2d8f9b7e8593cb0ea3d8db7b57b843387fa2b (diff)
Merge branch '63212-n-1-queries-in-projects-id-boards-api' into 'master'
Remove N+1 queries in boards API See merge request gitlab-org/gitlab-ce!29634
Diffstat (limited to 'spec')
-rw-r--r--spec/support/api/boards_shared_examples.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/support/api/boards_shared_examples.rb b/spec/support/api/boards_shared_examples.rb
index 592962ebf7c..3abb5096a7a 100644
--- a/spec/support/api/boards_shared_examples.rb
+++ b/spec/support/api/boards_shared_examples.rb
@@ -14,6 +14,16 @@ shared_examples_for 'group and project boards' do |route_definition, ee = false|
end
end
+ it 'avoids N+1 queries' do
+ pat = create(:personal_access_token, user: user)
+ control = ActiveRecord::QueryRecorder.new { get api(root_url, personal_access_token: pat) }
+
+ create(:milestone, "#{board_parent.class.name.underscore}": board_parent)
+ create(:board, "#{board_parent.class.name.underscore}": board_parent)
+
+ expect { get api(root_url, personal_access_token: pat) }.not_to exceed_query_limit(control)
+ end
+
describe "GET #{route_definition}" do
context "when unauthenticated" do
it "returns authentication error" do