Module: check_mk
Branch: master
Commit: 66c42e6e575d0bd7b341a74adda812c0e2683587
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=66c42e6e575d0b…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Oct 10 13:26:45 2016 +0200
tests: Now stop/start site when enabling livestatus via tcp when site was already running
---
tests/testlib/__init__.py | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/tests/testlib/__init__.py b/tests/testlib/__init__.py
index 16b2eff..4179054 100644
--- a/tests/testlib/__init__.py
+++ b/tests/testlib/__init__.py
@@ -276,14 +276,18 @@ class Site(object):
# This opens a currently free TCP port and remembers it in the object for later use
# Not free of races, but should be sufficient.
def open_livestatus_tcp(self):
+ start_again = False
+
if self.is_running():
- assert self.get_config("LIVESTATUS_TCP") == "on", \
- "Livestatus-TCP disabled (Site is running, so could not enable
it)"
- return
+ start_again = True
+ self.stop()
self.set_config("LIVESTATUS_TCP", "on")
self.set_config("LIVESTATUS_TCP_PORT", str(self._livestatus_port))
+ if start_again:
+ self.start()
+
def _gather_livestatus_port(self):
if self.reuse and self.exists():