Module: check_mk
Branch: master
Commit: 3ee6dad4161a51239e1ce5d1174b9defa7ec39cc
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3ee6dad4161a51…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Tue Aug 22 15:06:15 2017 +0200
Hacky workaround for spurious Jenkins failures.
Change-Id: I69e8c062b01e37908cfed53eda2d9a1cd73f3709
---
tests/testlib/__init__.py | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tests/testlib/__init__.py b/tests/testlib/__init__.py
index 4191da8..d166b88 100644
--- a/tests/testlib/__init__.py
+++ b/tests/testlib/__init__.py
@@ -1144,6 +1144,16 @@ class CMKWebSession(WebSession):
"Failed to activate %s: %r" % (site_id, status)
assert status["_time_ended"] > time_started
+ # HACK: Activating changes can involve an asynchronous(!) monitoring
+ # core restart/reload, so e.g. querying a Livestatus table immediately
+ # might not reflect the changes yet. The right way to handle this would
+ # be polling the "program_start" column of the "status" table
until the
+ # reload is complete. But this will only work if there is an actual
+ # restart/reload involved, which we don't know here, only our caller.
+ # Ugly workaround: Wait a moment and hope for the best, wasting a few
+ # seconds is better than a false positive during testing... >:-P
+ time.sleep(2)
+
def get_regular_graph(self, hostname, service_description, graph_index,
expect_error=False):
result = self._api_request("webapi.py?action=get_graph", {