Module: check_mk
Branch: master
Commit: 78657fed26562fec164b0d09339dd48f8a08a33c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=78657fed26562f…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Oct 21 13:42:54 2016 +0200
Added some more validations to test site setup code
---
tests/testlib/__init__.py | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/tests/testlib/__init__.py b/tests/testlib/__init__.py
index 4179054..bab151f 100644
--- a/tests/testlib/__init__.py
+++ b/tests/testlib/__init__.py
@@ -184,10 +184,16 @@ class Site(object):
def read_file(self, rel_path):
p = self.execute(["cat", "%s/%s" % (self.root, rel_path)],
stdout=subprocess.PIPE)
- p.wait()
+ if p.wait() != 0:
+ raise MKGeneralException("Failed to read file %s. Exit-Code: %d" %
(rel_path, p.wait()))
return p.stdout.read()
+ def file_exists(self, rel_path):
+ p = self.execute(["test", "-e", "%s/%s" %
(self.root, rel_path)], stdout=subprocess.PIPE)
+ return p.wait() == 0
+
+
def cleanup_if_wrong_version(self):
if not self.exists():
return
@@ -269,8 +275,15 @@ class Site(object):
web = CMKWebSession(self)
web.login()
web.get("wato.py")
- assert os.path.exists(self.root +
"/etc/check_mk/conf.d/wato/rules.mk"), \
- "Failed to initialize WATO data structures"
+
+ for f in [
+ "etc/check_mk/conf.d/wato/rules.mk",
+ "etc/check_mk/multisite.d/wato/hosttags.mk",
+ "etc/check_mk/conf.d/wato/global.mk",
+ "var/check_mk/web/automation",
+ "var/check_mk/web/automation/automation.secret" ]:
+ assert self.file_exists(f), \
+ "Failed to initialize WATO data structures (%s missing)" %
f
# This opens a currently free TCP port and remembers it in the object for later use