Module: check_mk
Branch: master
Commit: feec506fa454ef17d9a02ffcaf6ea7da133e3a5b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=feec506fa454ef…
Author: Jukka Aro <ja(a)mathias-kettner.de>
Date: Wed May 16 15:36:09 2018 +0200
Win-agent: test section ps followed by systemtime
Check that the ps 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 ps section.
Change-Id: Ica9d418ca67e7a4dc3e2cbeea88e43f20931f44c
---
agents/windows/it/test_section_ps.py | 35 ++++++++++++++++++++++++-----------
1 file changed, 24 insertions(+), 11 deletions(-)
diff --git a/agents/windows/it/test_section_ps.py b/agents/windows/it/test_section_ps.py
index 802a19c..d988a8b 100644
--- a/agents/windows/it/test_section_ps.py
+++ b/agents/windows/it/test_section_ps.py
@@ -7,8 +7,9 @@ import re
from remote import (actual_output, config, remotetest, remotedir, wait_agent,
write_config)
-section = 'ps'
-
+class Globals(object):
+ section = 'ps'
+ alone = True
@pytest.fixture
def testfile():
@@ -17,24 +18,36 @@ def testfile():
@pytest.fixture(params=['yes', 'no'], ids=['use_wmi=yes',
'use_wmi=no'])
def testconfig(request, config):
- config.set('global', 'sections', section)
+ config.set('global', 'sections', Globals.section)
config.set('global', 'crash_debug', 'yes')
- config.add_section(section)
- config.set(section, 'use_wmi', request.param)
+ config.add_section(Globals.section)
+ config.set(Globals.section, 'use_wmi', request.param)
return config
-(a)pytest.fixture(params=['yes'yes', 'no'], ids=['full_path=yes',
'full_path=no'])
-def full_path_config(request, testconfig):
- testconfig.set(section, 'full_path', request.param)
+(a)pytest.fixture(params=['alone'one', 'with_systemtime'])
+def testconfig_sections(request, testconfig):
+ Globals.alone = request.param == 'alone'
+ if Globals.alone:
+ testconfig.set('global', 'sections', Globals.section)
+ else:
+ testconfig.set('global', 'sections', '%s systemtime' %
Globals.section)
return testconfig
+(a)pytest.fixture(params=['yes'yes', 'no'], ids=['full_path=yes',
'full_path=no'])
+def full_path_config(request, testconfig_sections):
+ testconfig_sections.set(Globals.section, 'full_path', request.param)
+ return testconfig_sections
+
+
@pytest.fixture
def expected_output():
- return chain([re.escape(r'<<<ps:sep(9)>>>')],
- repeat(r'\([^,]+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+\)\s+'
- r'(.+\.[Ee][Xx][Ee]|System( Idle Process)?)'))
+ re_str = (r'\([^,]+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+\)\s+'
+ r'(.+\.[Ee][Xx][Ee]|System( Idle Process)?)')
+ if not Globals.alone:
+ re_str += r'|' + re.escape(r'<<<systemtime>>>')
+ r'|\d+'
+ return chain([re.escape(r'<<<ps:sep(9)>>>')],
repeat(re_str))
def test_section_ps(request, full_path_config, expected_output, actual_output,