[checkmk-commits] Fixed initial wato config check during test site creation

Lars Michelsen lm at mathias-kettner.de
Fri Nov 4 09:25:28 CET 2016


Module: check_mk
Branch: master
Commit: 06d90399cd79339634bddaf99a94669522c055a9
URL:    http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=06d90399cd79339634bddaf99a94669522c055a9

Author: Lars Michelsen <lm at mathias-kettner.de>
Date:   Fri Nov  4 09:25:24 2016 +0100

Fixed initial wato config check during test site creation

---

 tests/testlib/__init__.py | 31 +++++++++++++++++++++++--------
 1 file changed, 23 insertions(+), 8 deletions(-)

diff --git a/tests/testlib/__init__.py b/tests/testlib/__init__.py
index 96a39b2..661c6f8 100644
--- a/tests/testlib/__init__.py
+++ b/tests/testlib/__init__.py
@@ -289,14 +289,29 @@ class Site(object):
         assert "<title>WATO" in response
         assert "<div class=\"title\">Manual Checks</div>" in response
 
-        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
+        missing_files = [
+            "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"
+        ]
+
+        wait_time = 10
+        while missing_files and wait_time >= 0:
+            for f in missing_files[:]:
+                if self.file_exists(f):
+                    missing_files.remove(f)
+
+            if not missing_files:
+                break
+
+            time.sleep(0.5)
+            wait_time -= 0.5
+
+        assert not missing_files, \
+            "Failed to initialize WATO data structures " \
+            "(Still missing: %s)" % missing_files
 
 
     # This opens a currently free TCP port and remembers it in the object for later use



More information about the checkmk-commits mailing list