Module: check_mk
Branch: master
Commit: 0b56e58e8d2742149da972506ecdc9dc2a60667d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0b56e58e8d2742…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Wed Jan 11 13:59:02 2017 +0100
Be a bit more lenient when starting/stopping omd during tests.
Change-Id: I500223d17b1c05534765b43b987dda14e501d967
---
tests/testlib/__init__.py | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/tests/testlib/__init__.py b/tests/testlib/__init__.py
index 9e6345f..75763ff 100644
--- a/tests/testlib/__init__.py
+++ b/tests/testlib/__init__.py
@@ -309,16 +309,26 @@ class Site(object):
def start(self):
if not self.is_running():
assert omd(["start", self.id]) == 0
- if not self.is_running():
- raise Exception("The site %s is not running completely after
starting" % self.id)
-
+ i = 0
+ while not self.is_running():
+ i += 1
+ if i > 10:
+ raise Exception("Could not start site %s" % self.id)
+ print("The site %s is not running yet, sleeping... (round %d)"
% (self.id, i))
+ sys.stdout.flush()
+ time.sleep(0.2)
def stop(self):
if self.is_running():
assert omd(["stop", self.id]) == 0
- if self.is_running():
- raise Exception("The site %s is not completely stopped after
stopping" % self.id)
-
+ i = 0
+ while self.is_running():
+ i += 1
+ if i > 10:
+ raise Exception("Could not stop site %s" % self.id)
+ print("The site %s is still running, sleeping... (round %d)" %
(self.id, i))
+ sys.stdout.flush()
+ time.sleep(0.2)
def exists(self):
return os.path.exists("/omd/sites/%s" % self.id)