From 526665d4ec8f66738461f7b8e897ee6d92affda8 Mon Sep 17 00:00:00 2001 From: Renato Alves Date: Fri, 27 Mar 2015 10:51:38 +0000 Subject: [PATCH] Tests: Configurable check for taskd readyness * Also increase the frequency from 1/s to 2/s --- test/basetest/taskd.py | 9 +++++---- test/basetest/utils.py | 1 - 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/basetest/taskd.py b/test/basetest/taskd.py index 50f56ac9f..1b9381e2d 100644 --- a/test/basetest/taskd.py +++ b/test/basetest/taskd.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- +from __future__ import division import os import tempfile import shutil @@ -188,7 +189,7 @@ class Taskd(object): return True - def start(self, minutes=5): + def start(self, minutes=5, tries_per_minute=2): """Start the taskd server if it's not running. If it's already running OSError will be raised """ @@ -199,10 +200,10 @@ class Taskd(object): raise OSError("Taskd server is still running or crashed") # Wait for server to listen by checking connectivity in the port - # Default is to wait up to 5 minutes checking once each second - for i in range(minutes * 60): + # Default is to wait up to 5 minutes checking once every 500ms + for i in range(minutes * 60 * tries_per_minute): if not self.status(): - sleep(1) + sleep(1 / tries_per_minute) else: return diff --git a/test/basetest/utils.py b/test/basetest/utils.py index 2d1a04d0e..0d8df97c1 100644 --- a/test/basetest/utils.py +++ b/test/basetest/utils.py @@ -88,7 +88,6 @@ def wait_condition(cond, timeout=1): # Max number of attempts until giving up tries = int(timeout / sleeptime) - # Wait for up to a second for the process to finish and avoid zombies for i in range(tries): val = cond()