Commit 7fda457f authored by nmilojevic1's avatar nmilojevic1

Fix treeSaver and treeRestorer specs

- clean unused :use_legacy_pipeline_triggers ff
- remove redundant stub_feature_flag call from
  tree_saver_specs
- be consistent with allow(Feature) like we do in helper_spec
parent c3e7e5c4
...@@ -70,8 +70,7 @@ module Gitlab ...@@ -70,8 +70,7 @@ module Gitlab
# Do not create relation if it is: # Do not create relation if it is:
# - An unknown service # - An unknown service
# - A legacy trigger # - A legacy trigger
unknown_service? || unknown_service? || legacy_trigger?
(!Feature.enabled?(:use_legacy_pipeline_triggers, @importable) && legacy_trigger?)
end end
def setup_models def setup_models
......
...@@ -25,11 +25,14 @@ describe Gitlab::ImportExport::Project::TreeRestorer do ...@@ -25,11 +25,14 @@ describe Gitlab::ImportExport::Project::TreeRestorer do
@project = create(:project, :builds_enabled, :issues_disabled, name: 'project', path: 'project') @project = create(:project, :builds_enabled, :issues_disabled, name: 'project', path: 'project')
@shared = @project.import_export_shared @shared = @project.import_export_shared
allow(Feature).to receive(:enabled?).and_call_original allow(Feature).to receive(:enabled?) { true }
stub_feature_flags(project_import_ndjson: ndjson_enabled) stub_feature_flags(project_import_ndjson: ndjson_enabled)
setup_import_export_config('complex') setup_import_export_config('complex')
setup_reader(reader)
# FIXME: Disabling `setup_reader` temporarily to always fallback to legacy_relation_reader.
# See https://gitlab.com/gitlab-org/gitlab/-/issues/213793#note_320801541
# setup_reader(reader)
allow_any_instance_of(Repository).to receive(:fetch_source_branch!).and_return(true) allow_any_instance_of(Repository).to receive(:fetch_source_branch!).and_return(true)
allow_any_instance_of(Gitlab::Git::Repository).to receive(:branch_exists?).and_return(false) allow_any_instance_of(Gitlab::Git::Repository).to receive(:branch_exists?).and_return(false)
......
...@@ -29,12 +29,11 @@ describe Gitlab::ImportExport::Project::TreeSaver do ...@@ -29,12 +29,11 @@ describe Gitlab::ImportExport::Project::TreeSaver do
before_all do before_all do
RSpec::Mocks.with_temporary_scope do RSpec::Mocks.with_temporary_scope do
allow(Feature).to receive(:enabled?).and_call_original allow(Feature).to receive(:enabled?) { true }
stub_feature_flags(project_export_as_ndjson: ndjson_enabled) stub_feature_flags(project_export_as_ndjson: ndjson_enabled)
project.add_maintainer(user) project.add_maintainer(user)
stub_feature_flags(project_export_as_ndjson: ndjson_enabled)
project_tree_saver = described_class.new(project: project, current_user: user, shared: shared) project_tree_saver = described_class.new(project: project, current_user: user, shared: shared)
project_tree_saver.save project_tree_saver.save
......
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