Module: check_mk
Branch: master
Commit: f88b828f185e815262b89399eb0701b7a3e1d326
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f88b828f185e81…
Author: Jukka Aro <ja(a)mathias-kettner.de>
Date: Wed May 16 15:36:09 2018 +0200
Win-agent: test fileinfo followed by other section
Check that the fileinfo 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 fileinfo section.
Change-Id: I59bb44b0347a79ac5779504040d152f1f36bfbb3
---
agents/windows/it/test_section_fileinfo.py | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
diff --git a/agents/windows/it/test_section_fileinfo.py
b/agents/windows/it/test_section_fileinfo.py
index e90f434..533268d 100644
--- a/agents/windows/it/test_section_fileinfo.py
+++ b/agents/windows/it/test_section_fileinfo.py
@@ -11,6 +11,7 @@ import shutil
class Globals:
section = 'fileinfo'
+ alone = True
tempdir1 = os.path.join(remotedir, 'Testdir1')
tempdir2 = os.path.join(tempdir1, 'Testdir2')
tempfile1 = os.path.join(tempdir1, 'TestFile1')
@@ -26,22 +27,27 @@ def testfile(request):
@pytest.fixture(
params=[
- os.path.join(Globals.tempdir1, '**'),
- os.path.join(Globals.tempdir2, 'Te*')
+ (os.path.join(Globals.tempdir1, '**'), True),
+ (os.path.join(Globals.tempdir2, 'Te*'), True),
+ (os.path.join(Globals.tempdir2, 'Te*'), False)
],
- ids=['recursive_glob', 'simple_glob'])
+ ids=['recursive_glob', 'simple_glob_alone',
'simple_glob_with_systemtime'])
def testconfig(request, config):
if platform.system() == 'Windows':
- config.set('global', 'sections', Globals.section)
+ Globals.alone = request.param[1]
+ if Globals.alone:
+ config.set('global', 'sections', Globals.section)
+ else:
+ config.set('global', 'sections', '%s systemtime' %
Globals.section)
config.set('global', 'crash_debug', 'yes')
config.add_section(Globals.section)
- if request.param != os.path.join(Globals.tempdir1, '**'):
+ if request.param[0] != os.path.join(Globals.tempdir1, '**'):
config.set(Globals.section, 'path', Globals.tempfile1)
config.set(
Globals.section, 'path',
os.path.join(Globals.tempdir1,
'?' + os.path.basename(Globals.tempfile2)[1:]))
- config.set(Globals.section, 'path', request.param)
+ config.set(Globals.section, 'path', request.param[0])
config.set(Globals.section, 'path', Globals.missingfile)
return config
@@ -50,13 +56,19 @@ def testconfig(request, config):
@pytest.fixture
def expected_output():
if platform.system() == 'Windows':
- return [
+ expected = [
re.escape(r'<<<%s:sep(124)>>>' % Globals.section),
r'\d+',
re.escape(r'%s|' % Globals.tempfile1) + r'\d+\|\d+',
re.escape(r'%s|' % Globals.tempfile2) + r'\d+\|\d+',
re.escape(r'%s|' % Globals.tempfile3) + r'\d+\|\d+',
re.escape(r'%s|missing|' % Globals.missingfile) + r'\d+'
]
+ if not Globals.alone:
+ expected += [
+ re.escape(r'<<<systemtime>>>'),
+ r'\d+'
+ ]
+ return expected
@pytest.fixture