From 05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 18 Jan 2023 19:00:14 +0000 Subject: Add latest changes from gitlab-org/gitlab@15-8-stable-ee --- spec/lib/bulk_imports/groups/stage_spec.rb | 24 +++++++++++++++++++++- .../subgroup_to_entity_transformer_spec.rb | 5 +++-- 2 files changed, 26 insertions(+), 3 deletions(-) (limited to 'spec/lib/bulk_imports/groups') diff --git a/spec/lib/bulk_imports/groups/stage_spec.rb b/spec/lib/bulk_imports/groups/stage_spec.rb index 528d65615b1..cc772f07d21 100644 --- a/spec/lib/bulk_imports/groups/stage_spec.rb +++ b/spec/lib/bulk_imports/groups/stage_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe BulkImports::Groups::Stage do +RSpec.describe BulkImports::Groups::Stage, feature_category: :importers do let(:ancestor) { create(:group) } let(:group) { build(:group, parent: ancestor) } let(:bulk_import) { build(:bulk_import) } @@ -77,6 +77,28 @@ RSpec.describe BulkImports::Groups::Stage do ) end + describe 'migrate projects flag' do + context 'when true' do + it 'includes project entities pipeline' do + entity.update!(migrate_projects: true) + + expect(described_class.new(entity).pipelines).to include( + hash_including({ pipeline: BulkImports::Groups::Pipelines::ProjectEntitiesPipeline }) + ) + end + end + + context 'when false' do + it 'does not include project entities pipeline' do + entity.update!(migrate_projects: false) + + expect(described_class.new(entity).pipelines).not_to include( + hash_including({ pipeline: BulkImports::Groups::Pipelines::ProjectEntitiesPipeline }) + ) + end + end + end + context 'when feature flag is enabled on root ancestor level' do it 'includes project entities pipeline' do stub_feature_flags(bulk_import_projects: ancestor) diff --git a/spec/lib/bulk_imports/groups/transformers/subgroup_to_entity_transformer_spec.rb b/spec/lib/bulk_imports/groups/transformers/subgroup_to_entity_transformer_spec.rb index 6450d90ec0f..69cf80f92c5 100644 --- a/spec/lib/bulk_imports/groups/transformers/subgroup_to_entity_transformer_spec.rb +++ b/spec/lib/bulk_imports/groups/transformers/subgroup_to_entity_transformer_spec.rb @@ -6,7 +6,7 @@ RSpec.describe BulkImports::Groups::Transformers::SubgroupToEntityTransformer do describe "#transform" do it "transforms subgroups data in entity params" do parent = create(:group) - parent_entity = instance_double(BulkImports::Entity, group: parent, id: 1) + parent_entity = instance_double(BulkImports::Entity, group: parent, id: 1, migrate_projects: false) context = instance_double(BulkImports::Pipeline::Context, entity: parent_entity) subgroup_data = { "path" => "sub-group", @@ -18,7 +18,8 @@ RSpec.describe BulkImports::Groups::Transformers::SubgroupToEntityTransformer do source_full_path: "parent/sub-group", destination_name: "sub-group", destination_namespace: parent.full_path, - parent_id: 1 + parent_id: 1, + migrate_projects: false ) end end -- cgit v1.2.3