Commit 1533ff52 authored by James Lopez's avatar James Lopez

Merge branch '10io-remove-forward_npm_package_registry_requests-feature-flag' into 'master'

Remove forward npm package request feature flag

See merge request gitlab-org/gitlab!27987
parents fcbc3bf4 9ae07dbd
- if Feature.enabled?(:forward_npm_package_registry_requests, default_enabled: true) && Gitlab.config.packages.enabled
- if Gitlab.config.packages.enabled
%section.settings.as-package.no-animate#js-package-settings{ class: ('expanded' if expanded_by_default?) }
.settings-header
%h4
......
......@@ -9,7 +9,7 @@ module API
}.freeze
def redirect_registry_request(forward_to_registry, package_type, options)
if redirect_registry_request_available? && forward_to_registry
if forward_to_registry && redirect_registry_request_available?
redirect(registry_url(package_type, options))
else
yield
......@@ -28,7 +28,6 @@ module API
end
def redirect_registry_request_available?
Feature.enabled?(:forward_npm_package_registry_requests, default_enabled: true) &&
::Gitlab::CurrentSettings.current_application_settings.npm_package_requests_forwarding
end
end
......
......@@ -35,20 +35,15 @@ describe API::Helpers::Packages::DependencyProxyHelpers do
context 'with npm packages' do
let(:package_type) { :npm }
where(:feature_flag, :application_setting, :forward_to_registry, :example_name) do
true | true | true | 'executing redirect'
true | true | false | 'executing fallback'
true | false | true | 'executing fallback'
true | false | false | 'executing fallback'
false | true | true | 'executing fallback'
false | true | false | 'executing fallback'
false | false | true | 'executing fallback'
false | false | false | 'executing fallback'
where(:application_setting, :forward_to_registry, :example_name) do
true | true | 'executing redirect'
true | false | 'executing fallback'
false | true | 'executing fallback'
false | false | 'executing fallback'
end
with_them do
before do
stub_feature_flags(forward_npm_package_registry_requests: { enabled: feature_flag })
stub_application_setting(npm_package_requests_forwarding: application_setting)
end
......@@ -60,7 +55,6 @@ describe API::Helpers::Packages::DependencyProxyHelpers do
let(:forward_to_registry) { true }
before do
stub_feature_flags(forward_npm_package_registry_requests: { enabled: true })
stub_application_setting(npm_package_requests_forwarding: true)
end
......
......@@ -63,11 +63,6 @@ describe API::NpmPackages do
context 'a public project' do
it_behaves_like 'returning the npm package info'
context 'with forward_npm_package_registry_requests enabled' do
before do
stub_feature_flags(forward_npm_package_registry_requests: { enabled: true })
end
context 'with application setting enabled' do
before do
stub_application_setting(npm_package_requests_forwarding: true)
......@@ -94,17 +89,6 @@ describe API::NpmPackages do
it_behaves_like 'returning forbidden for unknown package'
end
end
context 'with forward_npm_package_registry_requests disabled' do
before do
stub_feature_flags(forward_npm_package_registry_requests: { enabled: false })
end
it_behaves_like 'returning the npm package info'
it_behaves_like 'returning forbidden for unknown package'
end
context 'project path with a dot' do
before do
......
......@@ -14,7 +14,7 @@ RSpec.shared_examples 'returns package tags' do |user_type|
using RSpec::Parameterized::TableSyntax
before do
stub_feature_flags(forward_npm_package_registry_requests: { enabled: false })
stub_application_setting(npm_package_requests_forwarding: false)
project.send("add_#{user_type}", user) unless user_type == :no_type
end
......
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