Commit 0b1cdba6 authored by Alexandru Croitor's avatar Alexandru Croitor

Update jira import state on background job failure

parent 602431a6
......@@ -18,7 +18,12 @@ module ProjectImportOptions
"import"
end
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'] })
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