Module: check_mk
Branch: master
Commit: c7e42fcd84e1848495fb5e4957446fc7a41c9443
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c7e42fcd84e184…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Feb 26 18:37:14 2019 +0100
Disable core host checking before test
Otherwise the core might perform host checks on it's own confusing our
notification test logic.
Change-Id: Ie4248d4818c0861fec330920f39c84f305995048
---
tests/integration/cmk_base/snmp/test_snmp.py | 2 +-
tests/integration/notifications/test_simple_rbn.py | 12 ++++++++----
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/tests/integration/cmk_base/snmp/test_snmp.py
b/tests/integration/cmk_base/snmp/test_snmp.py
index 3e08a61..f172ff3 100644
--- a/tests/integration/cmk_base/snmp/test_snmp.py
+++ b/tests/integration/cmk_base/snmp/test_snmp.py
@@ -96,7 +96,7 @@ def snmpsim(site, request, tmp_path_factory):
import netsnmp
var = netsnmp.Varbind("sysDescr.0")
result = netsnmp.snmpget(var, Version=2, DestHost="127.0.0.1:1337",
Community="public")
- if value is None or value[0] is None:
+ if result is None or value[0] is None:
return False
return True
diff --git a/tests/integration/notifications/test_simple_rbn.py
b/tests/integration/notifications/test_simple_rbn.py
index 2577514..b44e503 100644
--- a/tests/integration/notifications/test_simple_rbn.py
+++ b/tests/integration/notifications/test_simple_rbn.py
@@ -1,11 +1,13 @@
-import pytest
+# pylint: disable=redefined-outer-name
+
import time
+import pytest
-from testlib import web, WatchLog
+from testlib import web, WatchLog # pylint: disable=unused-import
@pytest.fixture()
-def test_config(web):
+def test_config(web, site):
users = {
"hh": {
"alias": "Harry Hirsch",
@@ -16,7 +18,7 @@ def test_config(web):
}
expected_users = set(["cmkadmin", "automation"] + users.keys())
- response = web.add_htpasswd_users(users)
+ web.add_htpasswd_users(users)
all_users = web.get_all_users()
assert not expected_users - set(all_users.keys())
@@ -27,6 +29,8 @@ def test_config(web):
})
web.activate_changes()
+ site.live.command("[%d] DISABLE_HOST_CHECK;notify-test" % time.time())
+
yield
web.delete_host("notify-test")