Commit abee680a authored by David Fernandez's avatar David Fernandez

Remove the check_maven_path_first feature flag

Update the related specs

Changelog: other
parent 15448f95
---
name: check_maven_path_first
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/59241
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/327487
milestone: '13.11'
type: development
group: group::package
default_enabled: true
...@@ -24,8 +24,6 @@ module API ...@@ -24,8 +24,6 @@ module API
helpers do helpers do
def path_exists?(path) def path_exists?(path)
# return true when FF disabled so that processing the request is not stopped
return true unless Feature.enabled?(:check_maven_path_first, default_enabled: :yaml)
return false if path.blank? return false if path.blank?
Packages::Maven::Metadatum.with_path(path) Packages::Maven::Metadatum.with_path(path)
......
...@@ -48,13 +48,9 @@ RSpec.describe API::MavenPackages do ...@@ -48,13 +48,9 @@ RSpec.describe API::MavenPackages do
end end
shared_examples 'rejecting the request for non existing maven path' do |expected_status: :not_found| shared_examples 'rejecting the request for non existing maven path' do |expected_status: :not_found|
before do it 'rejects the request' do
if Feature.enabled?(:check_maven_path_first, default_enabled: :yaml)
expect(::Packages::Maven::PackageFinder).not_to receive(:new) expect(::Packages::Maven::PackageFinder).not_to receive(:new)
end
end
it 'rejects the request' do
subject subject
expect(response).to have_gitlab_http_status(expected_status) expect(response).to have_gitlab_http_status(expected_status)
...@@ -166,7 +162,6 @@ RSpec.describe API::MavenPackages do ...@@ -166,7 +162,6 @@ RSpec.describe API::MavenPackages do
end end
describe 'GET /api/v4/packages/maven/*path/:file_name' do describe 'GET /api/v4/packages/maven/*path/:file_name' do
shared_examples 'handling all conditions' do
context 'a public project' do context 'a public project' do
subject { download_file(file_name: package_file.file_name) } subject { download_file(file_name: package_file.file_name) }
...@@ -297,23 +292,6 @@ RSpec.describe API::MavenPackages do ...@@ -297,23 +292,6 @@ RSpec.describe API::MavenPackages do
expect(response).to have_gitlab_http_status(:forbidden) expect(response).to have_gitlab_http_status(:forbidden)
end end
end end
end
context 'with check_maven_path_first enabled' do
before do
stub_feature_flags(check_maven_path_first: true)
end
it_behaves_like 'handling all conditions'
end
context 'with check_maven_path_first disabled' do
before do
stub_feature_flags(check_maven_path_first: false)
end
it_behaves_like 'handling all conditions'
end
def download_file(file_name:, params: {}, request_headers: headers, path: maven_metadatum.path) def download_file(file_name:, params: {}, request_headers: headers, path: maven_metadatum.path)
get api("/packages/maven/#{path}/#{file_name}"), params: params, headers: request_headers get api("/packages/maven/#{path}/#{file_name}"), params: params, headers: request_headers
...@@ -329,22 +307,6 @@ RSpec.describe API::MavenPackages do ...@@ -329,22 +307,6 @@ RSpec.describe API::MavenPackages do
let(:url) { "/packages/maven/#{path}/#{package_file.file_name}" } let(:url) { "/packages/maven/#{path}/#{package_file.file_name}" }
it_behaves_like 'processing HEAD requests', instance_level: true it_behaves_like 'processing HEAD requests', instance_level: true
context 'with check_maven_path_first enabled' do
before do
stub_feature_flags(check_maven_path_first: true)
end
it_behaves_like 'processing HEAD requests', instance_level: true
end
context 'with check_maven_path_first disabled' do
before do
stub_feature_flags(check_maven_path_first: false)
end
it_behaves_like 'processing HEAD requests', instance_level: true
end
end end
describe 'GET /api/v4/groups/:id/-/packages/maven/*path/:file_name' do describe 'GET /api/v4/groups/:id/-/packages/maven/*path/:file_name' do
...@@ -353,7 +315,6 @@ RSpec.describe API::MavenPackages do ...@@ -353,7 +315,6 @@ RSpec.describe API::MavenPackages do
group.add_developer(user) group.add_developer(user)
end end
shared_examples 'handling all conditions' do
context 'a public project' do context 'a public project' do
subject { download_file(file_name: package_file.file_name) } subject { download_file(file_name: package_file.file_name) }
...@@ -559,23 +520,6 @@ RSpec.describe API::MavenPackages do ...@@ -559,23 +520,6 @@ RSpec.describe API::MavenPackages do
end end
end end
end end
end
context 'with check_maven_path_first enabled' do
before do
stub_feature_flags(check_maven_path_first: true)
end
it_behaves_like 'handling all conditions'
end
context 'with check_maven_path_first disabled' do
before do
stub_feature_flags(check_maven_path_first: false)
end
it_behaves_like 'handling all conditions'
end
def download_file(file_name:, params: {}, request_headers: headers, path: maven_metadatum.path, group_id: group.id) def download_file(file_name:, params: {}, request_headers: headers, path: maven_metadatum.path, group_id: group.id)
get api("/groups/#{group_id}/-/packages/maven/#{path}/#{file_name}"), params: params, headers: request_headers get api("/groups/#{group_id}/-/packages/maven/#{path}/#{file_name}"), params: params, headers: request_headers
...@@ -590,25 +534,10 @@ RSpec.describe API::MavenPackages do ...@@ -590,25 +534,10 @@ RSpec.describe API::MavenPackages do
let(:path) { package.maven_metadatum.path } let(:path) { package.maven_metadatum.path }
let(:url) { "/groups/#{group.id}/-/packages/maven/#{path}/#{package_file.file_name}" } let(:url) { "/groups/#{group.id}/-/packages/maven/#{path}/#{package_file.file_name}" }
context 'with check_maven_path_first enabled' do
before do
stub_feature_flags(check_maven_path_first: true)
end
it_behaves_like 'processing HEAD requests'
end
context 'with check_maven_path_first disabled' do
before do
stub_feature_flags(check_maven_path_first: false)
end
it_behaves_like 'processing HEAD requests' it_behaves_like 'processing HEAD requests'
end end
end
describe 'GET /api/v4/projects/:id/packages/maven/*path/:file_name' do describe 'GET /api/v4/projects/:id/packages/maven/*path/:file_name' do
shared_examples 'handling all conditions' do
context 'a public project' do context 'a public project' do
subject { download_file(file_name: package_file.file_name) } subject { download_file(file_name: package_file.file_name) }
...@@ -676,23 +605,6 @@ RSpec.describe API::MavenPackages do ...@@ -676,23 +605,6 @@ RSpec.describe API::MavenPackages do
it_behaves_like 'rejecting the request for non existing maven path' it_behaves_like 'rejecting the request for non existing maven path'
end end
end end
end
context 'with check_maven_path_first enabled' do
before do
stub_feature_flags(check_maven_path_first: true)
end
it_behaves_like 'handling all conditions'
end
context 'with check_maven_path_first disabled' do
before do
stub_feature_flags(check_maven_path_first: false)
end
it_behaves_like 'handling all conditions'
end
def download_file(file_name:, params: {}, request_headers: headers, path: maven_metadatum.path) def download_file(file_name:, params: {}, request_headers: headers, path: maven_metadatum.path)
get api("/projects/#{project.id}/packages/maven/" \ get api("/projects/#{project.id}/packages/maven/" \
...@@ -708,22 +620,8 @@ RSpec.describe API::MavenPackages do ...@@ -708,22 +620,8 @@ RSpec.describe API::MavenPackages do
let(:path) { package.maven_metadatum.path } let(:path) { package.maven_metadatum.path }
let(:url) { "/projects/#{project.id}/packages/maven/#{path}/#{package_file.file_name}" } let(:url) { "/projects/#{project.id}/packages/maven/#{path}/#{package_file.file_name}" }
context 'with check_maven_path_first enabled' do
before do
stub_feature_flags(check_maven_path_first: true)
end
it_behaves_like 'processing HEAD requests'
end
context 'with check_maven_path_first disabled' do
before do
stub_feature_flags(check_maven_path_first: false)
end
it_behaves_like 'processing HEAD requests' it_behaves_like 'processing HEAD requests'
end end
end
describe 'PUT /api/v4/projects/:id/packages/maven/*path/:file_name/authorize' do describe 'PUT /api/v4/projects/:id/packages/maven/*path/:file_name/authorize' do
it 'rejects a malicious request' do it 'rejects a malicious request' 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