Commit 4b0f5f00 authored by James Lopez's avatar James Lopez

Merge branch '212659-update-jira-import-state' into 'master'

Update Jira import state on background job failure

See merge request gitlab-org/gitlab!29316
parents 79f56b54 0b1cdba6
......@@ -18,7 +18,12 @@ module ProjectImportOptions
"import"
end
if project.jira_import?
project.latest_jira_import.do_fail!
else
project.import_state.mark_as_failed(_("Every %{action} attempt has failed: %{job_error_message}. Please try again.") % { action: action, job_error_message: job['error_message'] })
end
Sidekiq.logger.warn "Failed #{job['class']} with #{job['args']}: #{job['error_message']}"
end
end
......
......@@ -39,6 +39,17 @@ describe ProjectImportOptions do
expect(project.import_state.reload.last_error).to include("import")
end
context 'when project is jira import' do
let(:project) { create(:project, import_type: 'jira') }
let!(:jira_import) { create(:jira_import_state, project: project) }
it 'logs the appropriate error message for forked projects' do
worker_class.sidekiq_retries_exhausted_block.call(job)
expect(project.latest_jira_import.reload.status).to eq('failed')
end
end
context 'when project does not have import_state' do
let(:project) { create(:project) }
......
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