You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/05/03 23:54:37 UTC

[GitHub] [airflow] mik-laj commented on a change in pull request #6277: [AIRFLOW-2971] Add health check CLI for scheduler

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:
users@infra.apache.org