Merge branch 'sh-backport-groups-api-optimization' into 'master'
Backport /api/v4/groups N+1 query check from EE See merge request gitlab-org/gitlab-ce!16913
This commit is contained in:
commit
aea3569b4f
1 changed files with 15 additions and 0 deletions
|
@ -30,6 +30,21 @@ describe API::Groups do
|
|||
expect(json_response)
|
||||
.to satisfy_one { |group| group['name'] == group1.name }
|
||||
end
|
||||
|
||||
it 'avoids N+1 queries' do
|
||||
# Establish baseline
|
||||
get api("/groups", admin)
|
||||
|
||||
control = ActiveRecord::QueryRecorder.new do
|
||||
get api("/groups", admin)
|
||||
end
|
||||
|
||||
create(:group)
|
||||
|
||||
expect do
|
||||
get api("/groups", admin)
|
||||
end.not_to exceed_query_limit(control)
|
||||
end
|
||||
end
|
||||
|
||||
context "when authenticated as user" do
|
||||
|
|
Loading…
Reference in a new issue