mik-laj commented on a change in pull request #6277:
URL: https://github.com/apache/airflow/pull/6277#discussion_r419176878



##########
File path: tests/cli/test_cli.py
##########
@@ -488,3 +490,26 @@ def test_run_naive_taskinstance(self, mock_local_job):
             pickle_id=None,
             pool=None,
         )
+
+    @mock.patch("airflow.bin.cli.jobs.SchedulerJob.most_recent_job")
+    def test_health_scheduler(self, mock_most_recent):
+        """
+        Test that the 'scheduler' subcommand for health works
+        """
+        job = SchedulerJob(
+            state='running',
+            latest_heartbeat=timezone.utcnow()
+        )
+        mock_most_recent.return_value = job
+
+        with conf_vars({("scheduler", "scheduler_health_check_threshold"): 
'60'}):
+            with mock.patch('sys.exit') as mock_exit:

Review comment:
       The cat on this method does not sound good because the question will not 
be able to use this method either. Can you catch the SystemExit exception 
instead?




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to