Module: check_mk
Branch: master
Commit: a4d1764f76fbd955958aae39cc9cad006d7a4fad
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a4d1764f76fbd9…
Author: Jukka Aro <ja(a)mathias-kettner.de>
Date: Wed May 16 15:36:09 2018 +0200
Win-agent: test openhardwaremonitor followed by systemtime
Check that the openhardwaremonitor 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
openhardwaremonitor section.
Change-Id: I02895ee28c93fee5db81d1cab58d46db806f12fc
---
.../windows/it/test_section_openhardwaremonitor.py | 37 +++++++++++++++-------
1 file changed, 25 insertions(+), 12 deletions(-)
diff --git a/agents/windows/it/test_section_openhardwaremonitor.py
b/agents/windows/it/test_section_openhardwaremonitor.py
index 30c424a..f060fbc 100644
--- a/agents/windows/it/test_section_openhardwaremonitor.py
+++ b/agents/windows/it/test_section_openhardwaremonitor.py
@@ -11,16 +11,28 @@ from remote import (actual_output, assert_subprocess, config,
remote_ip,
remotedir, remotetest, remoteuser, sshopts, write_config)
+class Globals(object):
+ alone = True
+
+
@pytest.fixture
def testfile():
return os.path.basename(__file__)
@pytest.fixture(
- params=['ohm', 'openhardwaremonitor'],
- ids=['sections=ohm', 'sections=openhardwaremonitor'])
+ params=[('ohm', True), ('openhardwaremonitor', True), ('ohm',
False),
+ ('openhardwaremonitor', False)],
+ ids=[
+ 'sections=ohm', 'sections=openhardwaremonitor',
+ 'sections=ohm_systemtime',
'sections=openhardwaremonitor_systemtime'
+ ])
def testconfig(request, config):
- config.set('global', 'sections', request.param)
+ Globals.alone = request.param[1]
+ if Globals.alone:
+ config.set('global', 'sections', request.param[0])
+ else:
+ config.set('global', 'sections', '%s systemtime' %
request.param[0])
config.set('global', 'crash_debug', 'yes')
return config
@@ -36,13 +48,15 @@ def wait_agent():
@pytest.fixture
def expected_output():
- return chain(
- [
- re.escape(r'<<<openhardwaremonitor:sep(44)>>>'),
- r'Index,Name,Parent,SensorType,Value'
- ],
- repeat(r'\d+,[A-Za-z ]+,(\/\w+)+,(Power|Clock|Load|Data|Temperature),'
- r'\d+\.\d{6}'))
+ re_str = (r'^\d+,[^,]+,(\/\w+)+,(Power|Clock|Load|Data|Temperature),'
+ r'\d+\.\d{6}')
+ if not Globals.alone:
+ re_str += r'|' + re.escape(r'<<<systemtime>>>')
+ '|\d+'
+ re_str += r'$'
+ return chain([
+ re.escape(r'<<<openhardwaremonitor:sep(44)>>>'),
+ r'Index,Name,Parent,SensorType,Value'
+ ], repeat(re_str))
def get_ohm_version(ohmdir):
@@ -93,5 +107,4 @@ def manage_ohm_binaries():
def test_section_openhardwaremonitor(request, testconfig, expected_output,
actual_output, testfile):
# request.node.name gives test name
- remotetest(expected_output, actual_output, testfile,
- request.node.name)
+ remotetest(expected_output, actual_output, testfile, request.node.name)