Skip to content

Commit

Permalink
WatchDog
Browse files Browse the repository at this point in the history
Updating unit tests

Signed-off-by: Rodrigo Nardi <[email protected]>
  • Loading branch information
RodrigoMNardi committed Jan 10, 2025
1 parent 3fc607c commit c1a3484
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
2 changes: 2 additions & 0 deletions spec/lib/github/build/action_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
allow(fake_github_check).to receive(:check_runs_for_ref).and_return({})
allow(BambooCi::Result).to receive(:fetch).and_return({})

allow(TimeoutExecution).to receive_message_chain(:delay, :timeout).and_return(true)

stage
end

Expand Down
2 changes: 2 additions & 0 deletions spec/lib/github/re_run/comment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

allow(Github::Build::UnavailableJobs).to receive(:new).and_return(fake_unavailable)
allow(fake_unavailable).to receive(:update).and_return([])

allow(TimeoutExecution).to receive_message_chain(:delay, :timeout).and_return(true)
end

describe 'Invalid payload' do
Expand Down
15 changes: 0 additions & 15 deletions spec/workers/timeout_execution_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,6 @@
end
end

context 'when timeout is called, but hanged' do
let(:check_suite) { create(:check_suite) }

before do
allow(CheckSuite).to receive(:find).and_return(check_suite)
allow(check_suite).to receive(:finished?).and_return(false)
allow(check_suite).to receive(:last_job_updated_at_timer).and_return(Time.now.utc - 3.hours)
allow(finished_instance).to receive(:finished).and_return([200, 'Finished'])
end

it 'calls timeout job' do
expect(described_class.timeout(check_suite.id)).to be_truthy
end
end

context 'when timeout is called and rescheduled' do
let(:check_suite) { create(:check_suite) }

Expand Down

0 comments on commit c1a3484

Please sign in to comment.