Commit aea3569b authored by Rémy Coutable's avatar Rémy Coutable

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
parents 679245e5 9cdde576
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment