Module: check_mk
Branch: master
Commit: 69222a4e6fd29d4dc69cf0526852df12fc442aa2
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=69222a4e6fd29d…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de>
Date: Fri Dec 14 14:12:24 2018 +0100
Replace 'default' placeholder in winperf_if tests
Change-Id: I77d9dcacb298cd7d8ae1093a3cc6b47e87187c51
---
tests/unit/checks/generictests/datasets/winperf_if_regression.py | 6 +++---
.../checks/generictests/datasets/winperf_if_teaming_regression.py | 8 ++++----
tests/unit/checks/generictests/run.py | 8 ++++++--
3 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/tests/unit/checks/generictests/datasets/winperf_if_regression.py
b/tests/unit/checks/generictests/datasets/winperf_if_regression.py
index 1d53c15..3aa8323 100644
--- a/tests/unit/checks/generictests/datasets/winperf_if_regression.py
+++ b/tests/unit/checks/generictests/datasets/winperf_if_regression.py
@@ -34,8 +34,8 @@ discovery = {'': [('1', "{'state':
['1'], 'speed': 10000000000}"),
checks = {'': [('1',
- 'default',
+ {'errors': (0.01, 0.1), 'state': ['1'],
'speed': 10000000000},
[(0, u'[TEAM:F[o]O 123-BAR] (Connected) 10.00 Gbit/s', [])]),
('2',
- 'default',
- [(0, u'[TEAM:F[o]O 123-BAR 2] (Connected) 10.00 Gbit/s', [])])]}
\ No newline at end of file
+ {'errors': (0.01, 0.1), 'state': ['1'],
'speed': 10000000000},
+ [(0, u'[TEAM:F[o]O 123-BAR 2] (Connected) 10.00 Gbit/s', [])])]}
diff --git a/tests/unit/checks/generictests/datasets/winperf_if_teaming_regression.py
b/tests/unit/checks/generictests/datasets/winperf_if_teaming_regression.py
index d3b724a..0696734 100644
--- a/tests/unit/checks/generictests/datasets/winperf_if_teaming_regression.py
+++ b/tests/unit/checks/generictests/datasets/winperf_if_teaming_regression.py
@@ -183,7 +183,7 @@ discovery = {'': [('1', "{'state':
['1'], 'speed': 10000000000}"),
('4', "{'state': ['1'], 'speed':
1000000000}")]}
-checks = {'': [('1', 'default', [(0, u'[A B-C] (Connected)
10.00 Gbit/s', [])]),
- ('2', 'default', [(0, u'[FOO B-A-R 53] (Connected) 1
Gbit/s', [])]),
- ('3', 'default', [(0, u'[A B-C 3] (Connected) 10.00
Gbit/s', [])]),
- ('4', 'default', [(0, u'[FOO B-A-R 52] (Connected) 1
Gbit/s', [])])]}
\ No newline at end of file
+checks = {'': [('1', {'errors': (0.01, 0.1), 'state':
['1'], 'speed': 10000000000}, [(0, u'[A B-C] (Connected) 10.00
Gbit/s', [])]),
+ ('2', {'errors': (0.01, 0.1), 'state':
['1'], 'speed': 1000000000}, [(0, u'[FOO B-A-R 53] (Connected) 1
Gbit/s', [])]),
+ ('3', {'errors': (0.01, 0.1), 'state':
['1'], 'speed': 10000000000}, [(0, u'[A B-C 3] (Connected) 10.00
Gbit/s', [])]),
+ ('4', {'errors': (0.01, 0.1), 'state':
['1'], 'speed': 1000000000}, [(0, u'[FOO B-A-R 52] (Connected) 1
Gbit/s', [])])]}
diff --git a/tests/unit/checks/generictests/run.py
b/tests/unit/checks/generictests/run.py
index d10990b..9f6c71a 100644
--- a/tests/unit/checks/generictests/run.py
+++ b/tests/unit/checks/generictests/run.py
@@ -1,4 +1,6 @@
"""Submodule providing the `run` function of generictests
package"""
+from ast import literal_eval
+
from checktestlib import DiscoveryResult, assertDiscoveryResultsEqual, \
CheckResult, assertCheckResultsEqual, \
MockHostExtraConf, MockItemState, \
@@ -48,8 +50,10 @@ def get_discovered_merged_parameters(check, provided_p):
if isinstance(provided_p, str):
if provided_p in check.context:
return check.context[provided_p], check.context[provided_p]
- # TODO: the repr case used e.g. in winperf_if is still not correct
- return default_p, "default"
+
+ evaluated_params = literal_eval(provided_p)
+ default_p.update(evaluated_params)
+ return default_p, default_p
raise DiscoveryParameterTypeError("unhandled: %r/%r" % (default_p,
provided_p))