xuganyu96 commented on code in PR #32707:
URL: https://github.com/apache/airflow/pull/32707#discussion_r1272931824
##########
tests/cli/commands/test_scheduler_command.py:
##########
@@ -139,6 +139,26 @@ def test_disable_scheduler_health(
with pytest.raises(AssertionError):
mock_process.assert_has_calls([mock.call(target=serve_health_check)])
+ @mock.patch("airflow.cli.commands.scheduler_command.SchedulerJobRunner")
+ @mock.patch("airflow.cli.commands.scheduler_command.Process")
+ @mock.patch("airflow.cli.commands.scheduler_command.run_job",
side_effect=Exception("run_job failed"))
+ @mock.patch("airflow.cli.commands.scheduler_command.log")
+ def test_run_job_exception_handling(
+ self,
+ mock_log,
+ mock_run_job,
+ mock_process,
+ mock_scheduler_job,
+ ):
+ args = self.parser.parse_args(["scheduler"])
+ scheduler_command.scheduler(args)
+
+ mock_run_job.assert_called()
+ mock_log.exception.assert_called()
+ mock_scheduler_job.assert_called()
+ mock_process.assert_has_calls([mock.call(target=serve_logs)])
+ mock_process().terminate.assert_called()
Review Comment:
Thank you for the feedback. Will update the test case to be more specific.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]