diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-06-12 15:15:58 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-06-12 15:15:58 +0200 |
commit | e6d66c4d3b8bdaa4abc85f3f35e0b06b785008da (patch) | |
tree | 1e29fc1325645c0810a1cf99e0e145995c728082 /spec/workers | |
parent | b4e84809e8170a43126507da0bc6a3b94c33804b (diff) | |
download | gitlab-ce-e6d66c4d3b8bdaa4abc85f3f35e0b06b785008da.tar.gz |
Don't fail builds for projects that are deleted when they are stuckdont-drop-stuck-builds
Diffstat (limited to 'spec/workers')
-rw-r--r-- | spec/workers/stuck_ci_builds_worker_spec.rb | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/spec/workers/stuck_ci_builds_worker_spec.rb b/spec/workers/stuck_ci_builds_worker_spec.rb index 665ec20f224..801fa31b45d 100644 --- a/spec/workers/stuck_ci_builds_worker_spec.rb +++ b/spec/workers/stuck_ci_builds_worker_spec.rb @@ -2,6 +2,7 @@ require "spec_helper" describe StuckCiBuildsWorker do let!(:build) { create :ci_build } + let(:worker) { described_class.new } subject do build.reload @@ -16,13 +17,13 @@ describe StuckCiBuildsWorker do it 'gets dropped if it was updated over 2 days ago' do build.update!(updated_at: 2.days.ago) - StuckCiBuildsWorker.new.perform + worker.perform is_expected.to eq('failed') end it "is still #{status}" do build.update!(updated_at: 1.minute.ago) - StuckCiBuildsWorker.new.perform + worker.perform is_expected.to eq(status) end end @@ -36,9 +37,21 @@ describe StuckCiBuildsWorker do it "is still #{status}" do build.update!(updated_at: 2.days.ago) - StuckCiBuildsWorker.new.perform + worker.perform is_expected.to eq(status) end end end + + context "for deleted project" do + before do + build.update!(status: :running, updated_at: 2.days.ago) + build.project.update(pending_delete: true) + end + + it "does not drop build" do + expect_any_instance_of(Ci::Build).not_to receive(:drop) + worker.perform + end + end end |