Module: check_mk
Branch: master
Commit: 046742147790767049e4acfbc3b048398002a429
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=04674214779076…
Author: Jukka Aro <ja(a)mathias-kettner.de>
Date: Wed May 16 15:36:09 2018 +0200
Win-agent: test wmi_cpuload followed by systemtime
Check that the wmi_cpuload section is correctly formatted until the end by
adding section systemtime after it. This is necessary for ensuring that
e. g. the newline is not left out at the end of the wmi_cpuload section.
Change-Id: Ib96be200b3ff221828dca2b8a6a9a969402038d2
---
agents/windows/it/test_section_wmi_cpuload.py | 28 +++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/agents/windows/it/test_section_wmi_cpuload.py
b/agents/windows/it/test_section_wmi_cpuload.py
index 5889ba6..346390f 100644
--- a/agents/windows/it/test_section_wmi_cpuload.py
+++ b/agents/windows/it/test_section_wmi_cpuload.py
@@ -6,23 +6,31 @@ import re
from remote import actual_output, config, remotetest, wait_agent, write_config
+class Globals(object):
+ section = 'wmi_cpuload'
+ alone = True
+
+
@pytest.fixture
def testfile():
return os.path.basename(__file__)
-(a)pytest.fixture
-def testconfig(config):
- section = 'wmi_cpuload'
- config.set('global', 'sections', section)
+(a)pytest.fixture(params=['alone'one', 'with_systemtime'])
+def testconfig(request, config):
+ Globals.alone = request.param == 'alone'
+ if Globals.alone:
+ config.set('global', 'sections', Globals.section)
+ else:
+ config.set('global', 'sections', '%s systemtime' %
Globals.section)
config.set('global', 'crash_debug', 'yes')
return config
@pytest.fixture
def expected_output():
- return [
- re.escape(r'<<<wmi_cpuload:sep(44)>>>'),
+ expected = [
+ re.escape(r'<<<%s:sep(44)>>>' % Globals.section),
re.escape(r'[system_perf]'),
(r'AlignmentFixupsPersec,Caption,ContextSwitchesPersec,Description,'
r'ExceptionDispatchesPersec,FileControlBytesPersec,'
@@ -59,8 +67,12 @@ def expected_output():
r'[\w-]+,,\d+,\d+,\d+,,[^,]+,\d+,\-?\d+,\d+,\d+,,,\d+,\d+,\d+,,[\w-]+,'
r'\d+,\d+,\d+,[^,]+,\w+,,[^,]*,,,,,[^,]+,\d+,\d+,[^,]*,\d+,\w*')
]
+ if not Globals.alone:
+ expected += [re.escape(r'<<<systemtime>>>'),
r'\d+']
+ return expected
-def test_section_wmi_cpuload(testconfig, expected_output, actual_output,
+def test_section_wmi_cpuload(request, testconfig, expected_output, actual_output,
testfile):
- remotetest(expected_output, actual_output, testfile)
+ # request.node.name gives test name
+ remotetest(expected_output, actual_output, testfile, request.node.name)