From d4db8ba9bc5f2f615f65bdf561c1993660ad2b36 Mon Sep 17 00:00:00 2001 From: Noah Levitt Date: Mon, 25 Jun 2018 10:35:24 -0500 Subject: [PATCH] is test_time_limit is failing because of timing? give it up to ten seconds to mark the job finished --- tests/test_cluster.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_cluster.py b/tests/test_cluster.py index 0ec5026..ae4f7a4 100644 --- a/tests/test_cluster.py +++ b/tests/test_cluster.py @@ -769,7 +769,7 @@ def test_time_limit(httpd): rr = doublethink.Rethinker('localhost', db='brozzler') frontier = brozzler.RethinkDbFrontier(rr) - # create a new job with three sites that could be crawled forever + # create a new job with one seed that could be crawled forever job_conf = {'seeds': [{ 'url': 'http://localhost:%s/infinite/foo/' % httpd.server_port, 'time_limit': 20}]} @@ -789,6 +789,10 @@ def test_time_limit(httpd): assert sites[0].status == 'FINISHED_TIME_LIMIT' # all sites finished so job should be finished too + start = time.time() job.refresh() + while not job.status == 'FINISHED' and time.time() - start < 10: + time.sleep(0.5) + job.refresh() assert job.status == 'FINISHED'