Skip to content

Commit

Permalink
WatchDog
Browse files Browse the repository at this point in the history
Removing deprecated method

Signed-off-by: Rodrigo Nardi <[email protected]>
  • Loading branch information
RodrigoMNardi committed Jan 10, 2025
1 parent c1a3484 commit a1741cb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
10 changes: 0 additions & 10 deletions lib/github/update_status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,6 @@ def fetch_delayed_job
Delayed::Job.where('handler LIKE ?', "%method_name: :update\nargs:\n- #{@job.check_suite.id}%")
end

def current_execution?
pull_request = @check_suite.pull_request
last_check_suite = pull_request.check_suites.reload.all.order(:created_at).last

logger Logger::INFO, "last_check_suite: #{last_check_suite.inspect}"
logger Logger::INFO, "@check_suite: #{@check_suite.inspect}"

@check_suite.id == last_check_suite.id
end

# The unable2find string must match the phrase defined in the ci-files repository file
# github_checks/hook_api.py method __topotest_title_summary
def failure
Expand Down
20 changes: 20 additions & 0 deletions spec/lib/github/update_status_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,26 @@
end
end

context 'when Ci Job TopoTest Part 0 update from in_progress -> success, but check suite is old' do
let(:pull_request) { create(:pull_request) }
let(:check_suite) { create(:check_suite, pull_request: pull_request) }
let(:check_suite_current) { create(:check_suite, pull_request: pull_request) }
let(:stage1) { create(:stage, check_suite: check_suite) }

let(:ci_job) { create(:ci_job, status: 'in_progress', stage: stage1, check_suite: check_suite) }
let(:status) { 'success' }

before do
check_suite
check_suite_current
ci_job
end

it 'must returns success' do
expect(update_status.update).to eq([200, 'Success'])
end
end

context 'when Ci Job TopoTest Part 0 update from in_progress -> failure' do
let(:check_suite) { create(:check_suite) }
let(:stage1) { create(:stage, check_suite: check_suite) }
Expand Down

0 comments on commit a1741cb

Please sign in to comment.