Skip to content

Commit

Permalink
PTFE-1450 update a bit test case
Browse files Browse the repository at this point in the history
  • Loading branch information
tcarmet committed Mar 6, 2024
1 parent 9375815 commit d477136
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
2 changes: 0 additions & 2 deletions bert_e/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,6 @@ class QueueOutOfOrder(TemplateException):
status = "failure"




class ResetComplete(TemplateException):
code = 128
template = "reset_complete.md"
Expand Down
15 changes: 9 additions & 6 deletions bert_e/tests/test_bert_e.py
Original file line number Diff line number Diff line change
Expand Up @@ -5446,17 +5446,20 @@ def test_validation_with_failed_stabilization_branch_stacked(self):
qc.validate()
self.assertEqual(qc.mergeable_prs, [1])


def test_notify_pr_on_queue_fail(self):
pr = self.create_pr('bugfix/TEST-01', 'development/4.3')
with self.assertRaises(exns.Queued):
self.handle(pr.id, options=self.bypass_all, backtrace=True)
self.gitrepo.cmd('git fetch')
branch = f"q/{pr.id}/4.3/{pr.src_branch}"
sha = self.gitrepo.cmd(f'git rev-parse origin/{branch}').rstrip()
self.set_build_status(sha1=sha, state='FAILED')
self.handle(pr.id, options=self.bypass_all)

self.set_build_status_on_branch_tip(branch, 'INPROGRESS')
with self.assertRaises(exns.NothingToDo):
self.handle(pr.id, options=self.bypass_all, backtrace=True)
self.set_build_status_on_branch_tip(branch, 'FAILED')
with self.assertRaises(exns.QueueBuildFailed):
self.handle(pr.id, options=self.bypass_all, backtrace=True)
# get last comment
comment = list(pr.get_comments())[-1].text
assert "Queue build failed" in comment

def test_system_nominal_case(self):
pr = self.create_pr('bugfix/TEST-00001', 'development/4.3')
Expand Down
4 changes: 3 additions & 1 deletion bert_e/workflow/gitwaterflow/queueing.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ def notify_queue_build_failed(failed_prs: List[int], job: QueuesJob):
pull_request = job.project_repo.get_pull_request(pr_id)
send_comment(
job.settings, pull_request, exceptions.QueueBuildFailedMessage(
active_options=job.active_options, frontend_url=job.bert_e.settings.frontend_url)
active_options=job.active_options,
frontend_url=job.bert_e.settings.frontend_url)
)


@job_handler(QueuesJob)
def handle_merge_queues(job):
"""Check merge queue and fast-forward development branches to the most
Expand Down

0 comments on commit d477136

Please sign in to comment.