Module: check_mk
Branch: master
Commit: 69357eb52eb6ec4e7ee49325ea9406566bf4e0d0
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=69357eb52eb6ec…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Fri Jan 19 14:02:16 2018 +0100
test_statgrab_cpu_check: Remove monkeypatching of time module, as it doesn't work this
way and is unnecessary
Change-Id: Ic86f0871393cc57d199699855b33209ed9466b54
---
tests/checks/test_statgrab_cpu_check.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tests/checks/test_statgrab_cpu_check.py
b/tests/checks/test_statgrab_cpu_check.py
index e43b017..e001129 100644
--- a/tests/checks/test_statgrab_cpu_check.py
+++ b/tests/checks/test_statgrab_cpu_check.py
@@ -22,12 +22,13 @@ info_statgrab_cpu_hpux = lambda t: [[u'idle', u'%d' %
int(t*5)],
),
])
def test_statgrab_cpu_check(check_manager, monkeypatch, time_to_info, params,
predicate):
- import time
check = check_manager.get_check("statgrab_cpu")
+ # NOTE: We do not mock the time module here, because the check does not depend on
any
+ # absolute rates. The mocking that was included in this test previously had no
+ # effect, which went unnoticed because it doesn't matter in this case.
try:
list(check.run_check(None, params, time_to_info(0)))
except MKCounterWrapped:
pass
- monkeypatch.setattr("time.time", lambda: 60)
result = checktestlib.CheckResult(check.run_check(None, params, time_to_info(60)))
assert predicate(result)