Skip to content

Commit

Permalink
fix: use better query for checking failed tests in notify
Browse files Browse the repository at this point in the history
Signed-off-by: joseph-sentry <joseph.sawaya@sentry.io>
  • Loading branch information
joseph-sentry committed Jan 15, 2024
1 parent 9284878 commit 59330a6
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tasks/notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,18 @@ async def run_async_within_lock(

# check if there were any test failures

test_instances = (
num_of_failed_test_instances = (
db_session.query(TestInstance)
.join(Upload)
.join(CommitReport)
.filter(CommitReport.commit_id == commit.id_)
.all()
.filter(
CommitReport.commit_id == commit.id_,
TestInstance.outcome == int(Outcome.Failure),
)
.count()
)
if any([instance.outcome == Outcome.Failure for instance in test_instances]):

if num_of_failed_test_instances > 0:
return {
"notify_attempted": False,
"notifications": None,
Expand Down

0 comments on commit 59330a6

Please sign in to comment.