Module: check_mk
Branch: master
Commit: bd7c74adc6004eb117e69f8bc6e141e107c5b24e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=bd7c74adc6004e…
Author: Jukka Aro <ja(a)mathias-kettner.de>
Date: Wed May 16 15:36:09 2018 +0200
Win-agent: test section services followed by systemtime
Check that the services 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 services section.
Change-Id: Ie187c1d331111c78de3842e6cadea511154e248c
---
agents/windows/it/test_section_ps.py | 2 ++
agents/windows/it/test_section_services.py | 30 ++++++++++++++++++++----------
2 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/agents/windows/it/test_section_ps.py b/agents/windows/it/test_section_ps.py
index d988a8b..189b298 100644
--- a/agents/windows/it/test_section_ps.py
+++ b/agents/windows/it/test_section_ps.py
@@ -7,10 +7,12 @@ import re
from remote import (actual_output, config, remotetest, remotedir, wait_agent,
write_config)
+
class Globals(object):
section = 'ps'
alone = True
+
@pytest.fixture
def testfile():
return os.path.basename(__file__)
diff --git a/agents/windows/it/test_section_services.py
b/agents/windows/it/test_section_services.py
index 983915f..43b2852 100644
--- a/agents/windows/it/test_section_services.py
+++ b/agents/windows/it/test_section_services.py
@@ -8,28 +8,38 @@ from remote import (actual_output, config, remotetest, remotedir,
wait_agent,
write_config)
+class Globals(object):
+ section = 'services'
+ alone = True
+
+
@pytest.fixture
def testfile():
return os.path.basename(__file__)
-(a)pytest.fixture
+(a)pytest.fixture(params=['alone'one', 'with_systemtime'])
def testconfig(request, config):
- section = 'services'
- config.set('global', 'sections', section)
+ 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 chain(
- [re.escape(r'<<<services>>>')],
- repeat(r'[\w\.-]+ (unknown|continuing|pausing|paused|running|starting'
- r'|stopping|stopped)/(invalid1|invalid2|invalid3|invalid4|auto'
- r'|boot|demand|disabled|system|other) .+'))
+ re_str = (r'[\w\.-]+ (unknown|continuing|pausing|paused|running|starting'
+ r'|stopping|stopped)/(invalid1|invalid2|invalid3|invalid4|auto'
+ r'|boot|demand|disabled|system|other) .+')
+ if not Globals.alone:
+ re_str += r'|' + re.escape(r'<<<systemtime>>>')
+ r'|\d+'
+ return chain([re.escape(r'<<<%s>>>' % Globals.section)],
repeat(re_str))
-def test_section_services(testconfig, expected_output, actual_output,
+def test_section_services(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)