Module: check_mk
Branch: master
Commit: ef448a7fcc3f909211e0fe4fb946e1d1e845a267
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ef448a7fcc3f90…
Author: Jukka Aro <ja(a)mathias-kettner.de>
Date: Wed May 16 15:36:09 2018 +0200
Win-agent: test df followed by other section
Check that the df 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 df section.
Change-Id: I14308dff7f1008faa78f6dca6b994991e13d4830
---
agents/windows/it/test_section_df.py | 36 ++++++++++++++++++++++++++----------
1 file changed, 26 insertions(+), 10 deletions(-)
diff --git a/agents/windows/it/test_section_df.py b/agents/windows/it/test_section_df.py
index ffb1d71..dc39103 100644
--- a/agents/windows/it/test_section_df.py
+++ b/agents/windows/it/test_section_df.py
@@ -7,15 +7,23 @@ from remote import (actual_output, config, remotetest, remotedir,
wait_agent,
write_config)
+class Globals(object):
+ section = 'df'
+ alone = True
+
+
@pytest.fixture
def testfile():
return os.path.basename(__file__)
-(a)pytest.fixture
-def testconfig(config):
- section = 'df'
- 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
@@ -23,12 +31,20 @@ def testconfig(config):
@pytest.fixture
def expected_output():
drive = r'[A-Z]:%s' % re.escape(os.sep)
- return [
- re.escape(r'<<<df:sep(9)>>>'),
+ expected = [
+ re.escape(r'<<<%s:sep(9)>>>' % Globals.section),
r'%s\s+\w+\s+\d+\s+\d+\s+\d+\s+\d{1,3}%s\s+%s' %
(drive, re.escape('%'), drive)
]
-
-
-def test_section_df(testconfig, expected_output, actual_output, testfile):
- remotetest(expected_output, actual_output, testfile)
+ if not Globals.alone:
+ expected += [
+ re.escape(r'<<<systemtime>>>'),
+ r'\d+'
+ ]
+ return expected
+
+
+def test_section_df(request, testconfig, expected_output, actual_output,
+ testfile):
+ # request.node.name gives test name
+ remotetest(expected_output, actual_output, testfile, request.node.name)