Commit 8c63ebd9 authored by Nikola Milojevic's avatar Nikola Milojevic

Merge branch 'mw-remove-group_import_export-ff' into 'master'

Remove group_import_export feature flag

See merge request gitlab-org/gitlab!84444
parents d1aef052 c5ff1bef
......@@ -15,7 +15,6 @@ class GroupsController < Groups::ApplicationController
prepend_before_action(only: [:show, :issues]) { authenticate_sessionless_user!(:rss) }
prepend_before_action(only: [:issues_calendar]) { authenticate_sessionless_user!(:ics) }
prepend_before_action :ensure_export_enabled, only: [:export, :download_export]
prepend_before_action :check_captcha, only: :create, if: -> { captcha_enabled? }
before_action :authenticate_user!, only: [:new, :create]
......@@ -339,10 +338,6 @@ class GroupsController < Groups::ApplicationController
check_rate_limit!(prefixed_action, scope: [current_user, scope].compact)
end
def ensure_export_enabled
render_404 unless Feature.enabled?(:group_import_export, @group, default_enabled: true)
end
private
def load_recaptcha
......
......@@ -3,7 +3,6 @@
class Import::GitlabGroupsController < ApplicationController
include WorkhorseAuthorization
before_action :ensure_group_import_enabled
before_action :check_import_rate_limit!, only: %i[create]
feature_category :importers
......@@ -51,10 +50,6 @@ class Import::GitlabGroupsController < ApplicationController
end
end
def ensure_group_import_enabled
render_404 unless Feature.enabled?(:group_import_export, @group, default_enabled: true)
end
def check_import_rate_limit!
check_rate_limit!(:group_import, scope: current_user) do
redirect_to new_group_path, alert: _('This endpoint has been requested too many times. Try again later.')
......
- return unless Feature.enabled?(:group_import_export, @group, default_enabled: true)
- group = local_assigns.fetch(:group)
.sub-section
......
---
name: group_import_export
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/22423
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/282245
milestone: '12.8'
type: development
group: group::import
default_enabled: true
......@@ -3,8 +3,6 @@
module API
class GroupExport < ::API::Base
before do
not_found! unless Feature.enabled?(:group_import_export, user_group, default_enabled: true)
authorize! :admin_group, user_group
end
......
......@@ -1084,19 +1084,6 @@ RSpec.describe GroupsController, factory_default: :keep do
enable_admin_mode!(admin)
end
context 'when the group export feature flag is not enabled' do
before do
sign_in(admin)
stub_feature_flags(group_import_export: false)
end
it 'returns a not found error' do
post :export, params: { id: group.to_param }
expect(response).to have_gitlab_http_status(:not_found)
end
end
context 'when the user does not have permission to export the group' do
before do
sign_in(guest)
......@@ -1197,19 +1184,6 @@ RSpec.describe GroupsController, factory_default: :keep do
end
end
context 'when the group export feature flag is not enabled' do
before do
sign_in(admin)
stub_feature_flags(group_import_export: false)
end
it 'returns a not found error' do
post :export, params: { id: group.to_param }
expect(response).to have_gitlab_http_status(:not_found)
end
end
context 'when the user does not have the required permissions' do
before do
sign_in(guest)
......
......@@ -26,22 +26,6 @@ RSpec.describe 'Group Export', :js do
end
end
context 'when the group import/export FF is disabled' do
before do
stub_feature_flags(group_import_export: false)
group.add_owner(user)
sign_in(user)
end
it 'does not show the group export options' do
visit edit_group_path(group)
expect(page).to have_content('Advanced')
expect(page).not_to have_content('Export group')
end
end
context 'when the signed in user does not have the required permission level' do
before do
group.add_guest(user)
......
......@@ -30,76 +30,62 @@ RSpec.describe API::GroupExport do
group.add_owner(user)
end
context 'group_import_export feature flag enabled' do
context 'when export file exists' do
before do
stub_feature_flags(group_import_export: true)
allow(Gitlab::ApplicationRateLimiter)
.to receive(:increment)
.and_return(0)
end
context 'when export file exists' do
before do
upload.export_file = fixture_file_upload('spec/fixtures/group_export.tar.gz', "`/tar.gz")
upload.save!
end
it 'downloads exported group archive' do
get api(download_path, user)
expect(response).to have_gitlab_http_status(:ok)
end
upload.export_file = fixture_file_upload('spec/fixtures/group_export.tar.gz', "`/tar.gz")
upload.save!
end
context 'when export_file.file does not exist' do
before do
expect_next_instance_of(ImportExportUploader) do |uploader|
expect(uploader).to receive(:file).and_return(nil)
end
end
it 'downloads exported group archive' do
get api(download_path, user)
it 'returns 404' do
get api(download_path, user)
expect(response).to have_gitlab_http_status(:ok)
end
expect(response).to have_gitlab_http_status(:not_found)
context 'when export_file.file does not exist' do
before do
expect_next_instance_of(ImportExportUploader) do |uploader|
expect(uploader).to receive(:file).and_return(nil)
end
end
context 'when object is not present' do
let(:other_group) { create(:group, :with_export) }
let(:other_download_path) { "/groups/#{other_group.id}/export/download" }
it 'returns 404' do
get api(download_path, user)
before do
other_group.add_owner(user)
other_group.export_file.file.delete
end
expect(response).to have_gitlab_http_status(:not_found)
end
end
it 'returns 404' do
get api(other_download_path, user)
context 'when object is not present' do
let(:other_group) { create(:group, :with_export) }
let(:other_download_path) { "/groups/#{other_group.id}/export/download" }
expect(response).to have_gitlab_http_status(:not_found)
expect(json_response['message']).to eq('The group export file is not available yet')
end
before do
other_group.add_owner(user)
other_group.export_file.file.delete
end
end
context 'when export file does not exist' do
it 'returns 404' do
get api(download_path, user)
get api(other_download_path, user)
expect(response).to have_gitlab_http_status(:not_found)
expect(json_response['message']).to eq('The group export file is not available yet')
end
end
end
context 'group_import_export feature flag disabled' do
before do
stub_feature_flags(group_import_export: false)
end
it 'responds with 404 Not Found' do
context 'when export file does not exist' do
it 'returns 404' do
get api(download_path, user)
allow(Gitlab::ApplicationRateLimiter)
.to receive(:increment)
.and_return(0)
expect(response).to have_gitlab_http_status(:not_found)
end
end
......@@ -122,58 +108,40 @@ RSpec.describe API::GroupExport do
end
describe 'POST /groups/:group_id/export' do
context 'group_import_export feature flag enabled' do
context 'when user is a group owner' do
before do
stub_feature_flags(group_import_export: true)
group.add_owner(user)
end
context 'when user is a group owner' do
before do
group.add_owner(user)
end
it 'accepts download' do
post api(path, user)
it 'accepts download' do
post api(path, user)
expect(response).to have_gitlab_http_status(:accepted)
end
expect(response).to have_gitlab_http_status(:accepted)
end
end
context 'when the export cannot be started' do
before do
group.add_owner(user)
allow(GroupExportWorker).to receive(:perform_async).and_return(nil)
end
it 'returns an error' do
post api(path, user)
expect(response).to have_gitlab_http_status(:error)
end
context 'when the export cannot be started' do
before do
group.add_owner(user)
allow(GroupExportWorker).to receive(:perform_async).and_return(nil)
end
context 'when user is not a group owner' do
before do
group.add_developer(user)
end
it 'forbids the request' do
post api(path, user)
it 'returns an error' do
post api(path, user)
expect(response).to have_gitlab_http_status(:forbidden)
end
expect(response).to have_gitlab_http_status(:error)
end
end
context 'group_import_export feature flag disabled' do
context 'when user is not a group owner' do
before do
stub_feature_flags(group_import_export: false)
group.add_developer(user)
end
it 'responds with 404 Not Found' do
it 'forbids the request' do
post api(path, user)
expect(response).to have_gitlab_http_status(:not_found)
expect(response).to have_gitlab_http_status(:forbidden)
end
end
......@@ -202,7 +170,6 @@ RSpec.describe API::GroupExport do
let(:status_path) { "/groups/#{group.id}/export_relations/status" }
before do
stub_feature_flags(group_import_export: true)
group.add_owner(user)
end
......
......@@ -155,20 +155,6 @@ RSpec.describe Import::GitlabGroupsController do
end
end
context 'when group import FF is disabled' do
let(:request_params) { { path: 'test-group-import', name: 'test-group-import' } }
before do
stub_feature_flags(group_import_export: false)
end
it 'returns an error' do
expect { import_request }.not_to change { Group.count }
expect(response).to have_gitlab_http_status(:not_found)
end
end
context 'when the parent group is invalid' do
let(:request_params) { { path: 'test-group-import', name: 'test-group-import', parent_id: -1 } }
......
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