diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
commit | 8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch) | |
tree | a77e7fe7a93de11213032ed4ab1f33a3db51b738 /spec/workers/stuck_import_jobs_worker_spec.rb | |
parent | 00b35af3db1abfe813a778f643dad221aad51fca (diff) |
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'spec/workers/stuck_import_jobs_worker_spec.rb')
-rw-r--r-- | spec/workers/stuck_import_jobs_worker_spec.rb | 47 |
1 files changed, 2 insertions, 45 deletions
diff --git a/spec/workers/stuck_import_jobs_worker_spec.rb b/spec/workers/stuck_import_jobs_worker_spec.rb index dcb8e59ed28..f8d7f8747d5 100644 --- a/spec/workers/stuck_import_jobs_worker_spec.rb +++ b/spec/workers/stuck_import_jobs_worker_spec.rb @@ -5,51 +5,8 @@ require 'spec_helper' describe StuckImportJobsWorker do let(:worker) { described_class.new } - shared_examples 'project import job detection' do - context 'when the job has completed' do - context 'when the import status was already updated' do - before do - allow(Gitlab::SidekiqStatus).to receive(:completed_jids) do - import_state.start - import_state.finish - - [import_state.jid] - end - end - - it 'does not mark the project as failed' do - worker.perform - - expect(import_state.reload.status).to eq('finished') - end - end - - context 'when the import status was not updated' do - before do - allow(Gitlab::SidekiqStatus).to receive(:completed_jids).and_return([import_state.jid]) - end - - it 'marks the project as failed' do - worker.perform - - expect(import_state.reload.status).to eq('failed') - end - end - end - - context 'when the job is still in Sidekiq' do - before do - allow(Gitlab::SidekiqStatus).to receive(:completed_jids).and_return([]) - end - - it 'does not mark the project as failed' do - expect { worker.perform }.not_to change { import_state.reload.status } - end - end - end - describe 'with scheduled import_status' do - it_behaves_like 'project import job detection' do + it_behaves_like 'stuck import job detection' do let(:import_state) { create(:project, :import_scheduled).import_state } before do @@ -59,7 +16,7 @@ describe StuckImportJobsWorker do end describe 'with started import_status' do - it_behaves_like 'project import job detection' do + it_behaves_like 'stuck import job detection' do let(:import_state) { create(:project, :import_started).import_state } before do |