[AIRFLOW-813] Fix unterminated scheduler unit tests Closes #2028 from fenglu-g/master
Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/cf6d50c0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/cf6d50c0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/cf6d50c0 Branch: refs/heads/v1-8-test Commit: cf6d50c0e3d59ec9155be445c127c90a05cc90a2 Parents: 6060f65 Author: Feng Lu <fen...@fengcloud.hot.corp.google.com> Authored: Fri Jan 27 21:03:15 2017 +0100 Committer: Bolke de Bruin <bo...@xs4all.nl> Committed: Fri Jan 27 21:03:18 2017 +0100 ---------------------------------------------------------------------- tests/jobs.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/cf6d50c0/tests/jobs.py ---------------------------------------------------------------------- diff --git a/tests/jobs.py b/tests/jobs.py index b674bcd..1872266 100644 --- a/tests/jobs.py +++ b/tests/jobs.py @@ -267,7 +267,8 @@ class SchedulerJobTest(unittest.TestCase): Utility function that runs a single scheduler loop without actually changing/scheduling any dags. This is useful to simulate the other side effects of running a scheduler loop, e.g. to see what parse errors there are in the - dags_folder. + dags_folder. The run_duration is limited to 20 seconds as the scheduler + will run forever as num_runs is ignored when there is no dag file. :param dags_folder: the directory to traverse :type directory: str @@ -275,7 +276,8 @@ class SchedulerJobTest(unittest.TestCase): scheduler = SchedulerJob( dag_id='this_dag_doesnt_exist', # We don't want to actually run anything num_runs=1, - subdir=os.path.join(dags_folder)) + subdir=os.path.join(dags_folder), + run_duration=20) scheduler.heartrate = 0 scheduler.run()