Commit 7affc231 authored by James Lopez's avatar James Lopez

add spec

parent 865bb64a
...@@ -569,6 +569,7 @@ class Project < ActiveRecord::Base ...@@ -569,6 +569,7 @@ class Project < ActiveRecord::Base
forked_from_project.repository_storage_path, forked_from_project.repository_storage_path,
forked_from_project.disk_path) forked_from_project.disk_path)
elsif gitlab_project_import? elsif gitlab_project_import?
# Do not retry on Import/Export until https://gitlab.com/gitlab-org/gitlab-ce/issues/26189 is solved.
RepositoryImportWorker.set(retry: false).perform_async(self.id) RepositoryImportWorker.set(retry: false).perform_async(self.id)
else else
RepositoryImportWorker.perform_async(self.id) RepositoryImportWorker.perform_async(self.id)
......
...@@ -21,7 +21,6 @@ class RepositoryImportWorker ...@@ -21,7 +21,6 @@ class RepositoryImportWorker
return if service.async? return if service.async?
if result[:status] == :error if result[:status] == :error
fail_import(project, result[:message]) if project.gitlab_project_import? fail_import(project, result[:message]) if project.gitlab_project_import?
raise result[:message] raise result[:message]
......
...@@ -52,6 +52,19 @@ describe RepositoryImportWorker do ...@@ -52,6 +52,19 @@ describe RepositoryImportWorker do
end.to raise_error(StandardError, error) end.to raise_error(StandardError, error)
expect(project.reload.import_jid).not_to be_nil expect(project.reload.import_jid).not_to be_nil
end end
it 'updates the error on Import/Export' do
error = %q{remote: Not Found fatal: repository 'https://user:pass@test.com/root/repoC.git/' not found }
project.update_attributes(import_jid: '123', import_type: 'gitlab_project')
expect_any_instance_of(Projects::ImportService).to receive(:execute).and_return({ status: :error, message: error })
expect do
subject.perform(project.id)
end.to raise_error(StandardError, error)
expect(project.reload.import_error).not_to be_nil
end
end end
context 'when using an asynchronous importer' do context 'when using an asynchronous importer' do
......
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