Commit 9b00092e authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'sh-fail-import-errors' into 'master'

Fail import state whenever repository import fails

See merge request gitlab-org/gitlab!49682
parents 2ba25d6b cd0e93a0
...@@ -30,7 +30,7 @@ class RepositoryImportWorker # rubocop:disable Scalability/IdempotentWorker ...@@ -30,7 +30,7 @@ class RepositoryImportWorker # rubocop:disable Scalability/IdempotentWorker
return if service.async? return if service.async?
if result[:status] == :error if result[:status] == :error
fail_import(result[:message]) if template_import? fail_import(result[:message])
raise result[:message] raise result[:message]
end end
......
---
title: Fail import state whenever repository import fails
merge_request: 49682
author:
type: fixed
...@@ -58,6 +58,7 @@ RSpec.describe RepositoryImportWorker do ...@@ -58,6 +58,7 @@ RSpec.describe RepositoryImportWorker do
subject.perform(project.id) subject.perform(project.id)
end.to raise_error(RuntimeError, error) end.to raise_error(RuntimeError, error)
expect(import_state.reload.jid).not_to be_nil expect(import_state.reload.jid).not_to be_nil
expect(import_state.status).to eq('failed')
end end
it 'updates the error on Import/Export' do it 'updates the error on Import/Export' do
...@@ -74,6 +75,7 @@ RSpec.describe RepositoryImportWorker do ...@@ -74,6 +75,7 @@ RSpec.describe RepositoryImportWorker do
end.to raise_error(RuntimeError, error) end.to raise_error(RuntimeError, error)
expect(import_state.reload.last_error).not_to be_nil expect(import_state.reload.last_error).not_to be_nil
expect(import_state.status).to eq('failed')
end 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