summaryrefslogtreecommitdiff
path: root/spec/requests/api/project_packages_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-09-04 00:09:08 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-09-04 00:09:08 +0000
commitdc965b8cc88f8dadf879c0d80214864c699ebf1f (patch)
treef6f23524912c004102a60cbd944e77ca2049ed2d /spec/requests/api/project_packages_spec.rb
parent692f4b734f1976b690dccb5458c198b5205c51b5 (diff)
downloadgitlab-ce-dc965b8cc88f8dadf879c0d80214864c699ebf1f.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests/api/project_packages_spec.rb')
-rw-r--r--spec/requests/api/project_packages_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/requests/api/project_packages_spec.rb b/spec/requests/api/project_packages_spec.rb
index 0ece3bff8f9..2f0d0fc87ec 100644
--- a/spec/requests/api/project_packages_spec.rb
+++ b/spec/requests/api/project_packages_spec.rb
@@ -104,6 +104,8 @@ RSpec.describe API::ProjectPackages do
expect(json_response.first['name']).to include(package2.name)
end
end
+
+ it_behaves_like 'does not cause n^2 queries'
end
end
@@ -127,6 +129,22 @@ RSpec.describe API::ProjectPackages do
end
context 'without the need for a license' do
+ context 'with build info' do
+ it 'does not result in additional queries' do
+ control = ActiveRecord::QueryRecorder.new do
+ get api(package_url, user)
+ end
+
+ pipeline = create(:ci_pipeline, user: user)
+ create(:ci_build, user: user, pipeline: pipeline)
+ create(:package_build_info, package: package1, pipeline: pipeline)
+
+ expect do
+ get api(package_url, user)
+ end.not_to exceed_query_limit(control)
+ end
+ end
+
context 'project is public' do
it 'returns 200 and the package information' do
subject