Skip to content

Commit

Permalink
fix: add logs in flaky test detection (#402)
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph-sentry authored Apr 22, 2024
1 parent d8fa620 commit e7911ce
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tasks/test_results_finisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,15 @@ def process_impl_within_lock(
)

if FLAKY_TEST_DETECTION.check_value(repo_id=repoid):
log.info(
"Running flaky test detection",
extra=dict(
repoid=repoid,
commit=commitid,
commit_yaml=commit_yaml,
parent_task=self.request.parent_id,
),
)
with metrics.timing("test_results.finisher.run_flaky_test_detection"):
success, reason = self.run_flaky_test_detection(
db_session, repoid, notifier, payload
Expand Down Expand Up @@ -315,16 +324,41 @@ def run_flaky_test_detection(
failure_normalizer,
)

log.info(
"Starting flake detection",
extra=dict(
repoid=repoid,
parent_task=self.request.parent_id,
),
)
current_state_of_repo_flakes = flake_detection_engine.detect_flakes()

for test_id, symptoms in current_state_of_repo_flakes.items():
log.info(
"Discovered flaky test",
extra=dict(
repoid=repoid,
parent_task=self.request.parent_id,
test_id=test_id,
symptoms=list(symptoms),
),
)
payload.flaky_tests[test_id] = TestResultsNotificationFlake(
list(symptoms),
True,
)
db_session.flush()

success, reason = async_to_sync(notifier.notify)(payload)
log.info(
"Added flaky test information to the PR comment",
extra=dict(
repoid=repoid,
parent_task=self.request.parent_id,
success=success,
reason=reason,
),
)

return success, reason

Expand Down

0 comments on commit e7911ce

Please sign in to comment.