From e7911ce35b3991a59dec6e1d47df4d894ee27198 Mon Sep 17 00:00:00 2001 From: joseph-sentry <136376984+joseph-sentry@users.noreply.github.com> Date: Mon, 22 Apr 2024 10:36:23 -0400 Subject: [PATCH] fix: add logs in flaky test detection (#402) --- tasks/test_results_finisher.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tasks/test_results_finisher.py b/tasks/test_results_finisher.py index f8989536c..97eeee4b9 100644 --- a/tasks/test_results_finisher.py +++ b/tasks/test_results_finisher.py @@ -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 @@ -315,9 +324,25 @@ 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, @@ -325,6 +350,15 @@ def run_flaky_test_detection( 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