diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-28 09:10:17 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-28 09:10:17 +0300 |
commit | cf73ed7d11fdf517c230038fe8c88c96b7e3d6f0 (patch) | |
tree | 2bff9cfe778217ae462963ff4c22bb80bd274969 /spec/workers | |
parent | c01895daab6ec8bffc5466a8330fc154fd47a726 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers')
-rw-r--r-- | spec/workers/stuck_ci_jobs_worker_spec.rb | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/spec/workers/stuck_ci_jobs_worker_spec.rb b/spec/workers/stuck_ci_jobs_worker_spec.rb index 84b2d87494e..961cd5fc070 100644 --- a/spec/workers/stuck_ci_jobs_worker_spec.rb +++ b/spec/workers/stuck_ci_jobs_worker_spec.rb @@ -186,20 +186,32 @@ RSpec.describe StuckCiJobsWorker do end end - context 'when job is running' do - let(:status) { 'running' } + shared_examples 'job is running' do + context 'when job is running' do + let(:status) { 'running' } + + context 'when job was updated_at more than an hour ago' do + let(:updated_at) { 2.hours.ago } - context 'when job was updated_at more than an hour ago' do - let(:updated_at) { 2.hours.ago } + it_behaves_like 'job is dropped' + end + + context 'when job was updated in less than 1 hour ago' do + let(:updated_at) { 30.minutes.ago } - it_behaves_like 'job is dropped' + it_behaves_like 'job is unchanged' + end end + end - context 'when job was updated in less than 1 hour ago' do - let(:updated_at) { 30.minutes.ago } + it_behaves_like 'job is running' - it_behaves_like 'job is unchanged' + context 'when ci_new_query_for_running_stuck_jobs feature flag is disabled' do + before do + stub_feature_flags(ci_new_query_for_running_stuck_jobs: false) end + + it_behaves_like 'job is running' end %w(success skipped failed canceled).each do |status| |