Commit 3783e105 authored by Kerri Miller's avatar Kerri Miller

Merge branch 'kassio/remove-ff-log_import_export_relation_creation' into 'master'

Remove `log_import_export_relation_creation` feature flag

See merge request gitlab-org/gitlab!77144
parents 62f792e3 ad7c30ff
---
name: log_import_export_relation_creation
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/27605
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/282245
milestone: '12.10'
type: development
group: group::import
default_enabled: false
......@@ -264,14 +264,12 @@ module Gitlab
@relation_reader.sort_ci_pipelines_by_id
end
# Enable logging of each top-level relation creation when Importing
# into a Group if feature flag is enabled
# Enable logging of each top-level relation creation when Importing into a Group
def log_relation_creation(importable, relation_key, relation_object)
root_ancestor_group = importable.try(:root_ancestor)
return unless root_ancestor_group
return unless root_ancestor_group.instance_of?(::Group)
return unless Feature.enabled?(:log_import_export_relation_creation, root_ancestor_group)
@shared.logger.info(
importable_type: importable.class.to_s,
......
......@@ -48,41 +48,16 @@ RSpec.describe Gitlab::ImportExport::Group::RelationTreeRestorer do
subject { relation_tree_restorer.restore }
shared_examples 'logging of relations creation' do
context 'when log_import_export_relation_creation feature flag is enabled' do
before do
stub_feature_flags(log_import_export_relation_creation: group)
end
it 'logs top-level relation creation' do
expect(shared.logger)
.to receive(:info)
.with(hash_including(message: '[Project/Group Import] Created new object relation'))
.at_least(:once)
subject
end
end
context 'when log_import_export_relation_creation feature flag is disabled' do
before do
stub_feature_flags(log_import_export_relation_creation: false)
end
it 'does not log top-level relation creation' do
expect(shared.logger)
.to receive(:info)
.with(hash_including(message: '[Project/Group Import] Created new object relation'))
.never
subject
end
end
end
it 'restores group tree' do
expect(subject).to eq(true)
end
include_examples 'logging of relations creation'
it 'logs top-level relation creation' do
expect(shared.logger)
.to receive(:info)
.with(hash_including(message: '[Project/Group Import] Created new object relation'))
.at_least(:once)
subject
end
end
......@@ -54,38 +54,6 @@ RSpec.describe Gitlab::ImportExport::Project::RelationTreeRestorer do
end
end
shared_examples 'logging of relations creation' do
context 'when log_import_export_relation_creation feature flag is enabled' do
before do
stub_feature_flags(log_import_export_relation_creation: group)
end
it 'logs top-level relation creation' do
expect(shared.logger)
.to receive(:info)
.with(hash_including(message: '[Project/Group Import] Created new object relation'))
.at_least(:once)
subject
end
end
context 'when log_import_export_relation_creation feature flag is disabled' do
before do
stub_feature_flags(log_import_export_relation_creation: false)
end
it 'does not log top-level relation creation' do
expect(shared.logger)
.to receive(:info)
.with(hash_including(message: '[Project/Group Import] Created new object relation'))
.never
subject
end
end
end
context 'with legacy reader' do
let(:path) { 'spec/fixtures/lib/gitlab/import_export/complex/project.json' }
let(:relation_reader) do
......@@ -106,7 +74,14 @@ RSpec.describe Gitlab::ImportExport::Project::RelationTreeRestorer do
create(:project, :builds_enabled, :issues_disabled, name: 'project', path: 'project', group: group)
end
include_examples 'logging of relations creation'
it 'logs top-level relation creation' do
expect(shared.logger)
.to receive(:info)
.with(hash_including(message: '[Project/Group Import] Created new object relation'))
.at_least(:once)
subject
end
end
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