Commit 8644894d authored by Kassio Borges's avatar Kassio Borges

Split group_import_export_ndjson feature flag

Use one Feature Flat to Group Import and another one to Group Export
to have a more granular control about Group Import/Export with ndjson.
parent 3ed37596
...@@ -65,7 +65,7 @@ module Groups ...@@ -65,7 +65,7 @@ module Groups
end end
def tree_exporter_class def tree_exporter_class
if ::Feature.enabled?(:group_import_export_ndjson, @group&.parent) if ::Feature.enabled?(:group_export_ndjson, @group&.parent)
Gitlab::ImportExport::Group::TreeSaver Gitlab::ImportExport::Group::TreeSaver
else else
Gitlab::ImportExport::Group::LegacyTreeSaver Gitlab::ImportExport::Group::LegacyTreeSaver
......
...@@ -53,7 +53,7 @@ module Groups ...@@ -53,7 +53,7 @@ module Groups
end end
def ndjson? def ndjson?
::Feature.enabled?(:group_import_export_ndjson, @group&.parent) && ::Feature.enabled?(:group_import_ndjson, @group&.parent) &&
File.exist?(File.join(@shared.export_path, 'tree/groups/_all.ndjson')) File.exist?(File.join(@shared.export_path, 'tree/groups/_all.ndjson'))
end end
......
...@@ -50,7 +50,7 @@ describe Groups::ImportExport::ExportService do ...@@ -50,7 +50,7 @@ describe Groups::ImportExport::ExportService do
end end
it 'saves the models using ndjson tree saver' do it 'saves the models using ndjson tree saver' do
stub_feature_flags(group_import_export_ndjson: true) stub_feature_flags(group_export_ndjson: true)
expect(Gitlab::ImportExport::Group::TreeSaver).to receive(:new).and_call_original expect(Gitlab::ImportExport::Group::TreeSaver).to receive(:new).and_call_original
...@@ -58,7 +58,7 @@ describe Groups::ImportExport::ExportService do ...@@ -58,7 +58,7 @@ describe Groups::ImportExport::ExportService do
end end
it 'saves the models using legacy tree saver' do it 'saves the models using legacy tree saver' do
stub_feature_flags(group_import_export_ndjson: false) stub_feature_flags(group_export_ndjson: false)
expect(Gitlab::ImportExport::Group::LegacyTreeSaver).to receive(:new).and_call_original expect(Gitlab::ImportExport::Group::LegacyTreeSaver).to receive(:new).and_call_original
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
describe Groups::ImportExport::ImportService do describe Groups::ImportExport::ImportService do
context 'with group_import_export_ndjson feature flag disabled' do context 'with group_import_ndjson feature flag disabled' do
let(:user) { create(:admin) } let(:user) { create(:admin) }
let(:group) { create(:group) } let(:group) { create(:group) }
let(:import_logger) { instance_double(Gitlab::Import::Logger) } let(:import_logger) { instance_double(Gitlab::Import::Logger) }
...@@ -11,7 +11,7 @@ describe Groups::ImportExport::ImportService do ...@@ -11,7 +11,7 @@ describe Groups::ImportExport::ImportService do
subject(:service) { described_class.new(group: group, user: user) } subject(:service) { described_class.new(group: group, user: user) }
before do before do
stub_feature_flags(group_import_export_ndjson: false) stub_feature_flags(group_import_ndjson: false)
ImportExportUpload.create(group: group, import_file: import_file) ImportExportUpload.create(group: group, import_file: import_file)
...@@ -39,9 +39,9 @@ describe Groups::ImportExport::ImportService do ...@@ -39,9 +39,9 @@ describe Groups::ImportExport::ImportService do
end end
end end
context 'with group_import_export_ndjson feature flag enabled' do context 'with group_import_ndjson feature flag enabled' do
before do before do
stub_feature_flags(group_import_export_ndjson: true) stub_feature_flags(group_import_ndjson: true)
end end
context 'when importing a ndjson export' do context 'when importing a ndjson export' 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