diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-10-21 11:29:47 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-11-03 13:12:16 +0100 |
commit | 8d2758e02d634fd8518893f39dcc3359284e890f (patch) | |
tree | 8a1d0dada6d607aba39d02f4b3ea2824e6774162 /spec/workers | |
parent | fb2f8be4d7cddc01471b58334c33ecdee4d0b887 (diff) | |
download | gitlab-ce-8d2758e02d634fd8518893f39dcc3359284e890f.tar.gz |
Cleanup stuck CI builds dailydrop-old-builds
Diffstat (limited to 'spec/workers')
-rw-r--r-- | spec/workers/stuck_ci_builds_worker_spec.rb | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/workers/stuck_ci_builds_worker_spec.rb b/spec/workers/stuck_ci_builds_worker_spec.rb new file mode 100644 index 00000000000..f9d87d97014 --- /dev/null +++ b/spec/workers/stuck_ci_builds_worker_spec.rb @@ -0,0 +1,44 @@ +require "spec_helper" + +describe StuckCiBuildsWorker do + let!(:build) { create :ci_build } + + subject do + build.reload + build.status + end + + %w(pending running).each do |status| + context "#{status} build" do + before do + build.update!(status: status) + end + + it 'gets dropped if it was updated over 2 days ago' do + build.update!(updated_at: 2.day.ago) + StuckCiBuildsWorker.new.perform + is_expected.to eq('failed') + end + + it "is still #{status}" do + build.update!(updated_at: 1.minute.ago) + StuckCiBuildsWorker.new.perform + is_expected.to eq(status) + end + end + end + + %w(success failed canceled).each do |status| + context "#{status} build" do + before do + build.update!(status: status) + end + + it "is still #{status}" do + build.update!(updated_at: 2.day.ago) + StuckCiBuildsWorker.new.perform + is_expected.to eq(status) + end + end + end +end |