Commit 14a16e2e authored by Stan Hu's avatar Stan Hu

Merge branch 'fix-exit-1' into 'master'

Do not exit during specs from `import.rake`

See merge request gitlab-org/gitlab!21054
parents 8a1e52c6 0d73e307
......@@ -12,6 +12,8 @@ describe 'gitlab:import_export:import rake task', :sidekiq do
before do
Rake.application.rake_require('tasks/gitlab/import_export/import')
allow(Settings.uploads.object_store).to receive(:[]=).and_call_original
allow_any_instance_of(GitlabProjectImport).to receive(:exit)
.and_raise(RuntimeError, 'exit not handled')
end
around do |example|
......@@ -95,6 +97,10 @@ describe 'gitlab:import_export:import rake task', :sidekiq do
end
it 'fails project import with an error' do
# Catch exit call, and raise exception instead
expect_any_instance_of(GitlabProjectImport).to receive(:exit)
.with(1).and_raise(SystemExit)
expect { subject }.to raise_error(SystemExit).and output(error).to_stdout
expect(project.merge_requests).to be_empty
......
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