Module: check_mk
Branch: master
Commit: b7d9c6b15a240120834be0e7f4bf38805e969413
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b7d9c6b15a2401…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Mar 6 11:40:33 2019 +0100
test_active_check: Reduced number of core changes
Change-Id: Ie8692e72c85402a816e8f670e743b88df8015365
---
tests/integration/core/test_active_checks.py | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/tests/integration/core/test_active_checks.py
b/tests/integration/core/test_active_checks.py
index cac1a64..abb4e7d 100644
--- a/tests/integration/core/test_active_checks.py
+++ b/tests/integration/core/test_active_checks.py
@@ -1,15 +1,22 @@
#!/usr/bin/env python
# encoding: utf-8
+# pylint: disable=redefined-outer-name
+import collections
import pytest
-from testlib import web
+from testlib import web # pylint: disable=unused-import
import cmk_base.config as config
+DefaultConfig = collections.namedtuple("DefaultConfig", ["core"])
+
+
+(a)pytest.fixture(scope="module"dule", params=["nagios", "cmc"])
+def test_cfg(request, web, site):
+ config = DefaultConfig(core=request.param)
+ site.set_config("CORE", config.core, with_restart=True)
-(a)pytest.fixture(scope="module")
-def test_cfg(web, site):
print "Applying default config"
web.add_host(
"test-host", attributes={
@@ -18,7 +25,7 @@ def test_cfg(web, site):
})
web.activate_changes()
- yield None
+ yield config
#
# Cleanup code
@@ -28,10 +35,7 @@ def test_cfg(web, site):
web.delete_host("test-host")
-(a)pytest.mark.parametrize(("core")ore"), ["nagios", "cmc"])
-def test_active_check_execution(test_cfg, site, web, core):
- site.set_config("CORE", core, with_restart=True)
-
+def test_active_check_execution(test_cfg, site, web):
try:
web.set_ruleset(
"custom_checks",
@@ -75,10 +79,7 @@ def test_active_check_execution(test_cfg, site, web, core):
web.activate_changes()
-(a)pytest.mark.parametrize(("core")ore"), ["nagios", "cmc"])
-def test_active_check_macros(test_cfg, site, web, core):
- site.set_config("CORE", core, with_restart=True)
-
+def test_active_check_macros(test_cfg, site, web):
macros = {
"$HOSTADDRESS$": "127.0.0.1",
"$HOSTNAME$": "test-host",
@@ -141,7 +142,7 @@ def test_active_check_macros(test_cfg, site, web, core):
expected_output = "Output: %s" % value
# TODO: Cleanup difference between nagios/cmc
- if core == "nagios":
+ if test_cfg.core == "nagios":
expected_output = expected_output.strip()
if var == "$_HOSTTAGS$":
splitted_output = plugin_output.split(" ")