Module: check_mk
Branch: master
Commit: c1ec44e40447f19e9e1b77dccb376ec3b83c251f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c1ec44e40447f1…
Author: Jukka Aro <ja(a)mathias-kettner.de>
Date: Wed May 16 15:36:09 2018 +0200
Win-agent: test section winperf followed by systemtime
Check that the winperf 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 winperf section.
Change-Id: I0af5a19092bc0aadf98980c1c85ae025f940e628
---
agents/windows/it/test_section_winperf.py | 39 +++++++++++++++++++++++--------
1 file changed, 29 insertions(+), 10 deletions(-)
diff --git a/agents/windows/it/test_section_winperf.py
b/agents/windows/it/test_section_winperf.py
index dfa0ccc..fd3db4d 100644
--- a/agents/windows/it/test_section_winperf.py
+++ b/agents/windows/it/test_section_winperf.py
@@ -3,30 +3,49 @@
from itertools import repeat
import os
import pytest
+import re
from remote import actual_output, config, remotetest, wait_agent, write_config
+class Globals(object):
+ section = 'winperf'
+ alone = True
+
+
@pytest.fixture
def testfile():
return os.path.basename(__file__)
-(a)pytest.fixture(params=['System'tem', '2'], ids=['counter:System',
'counter:2'])
-def testconfig(request, config):
- section = 'winperf'
- config.set('global', 'sections', section)
+(a)pytest.fixture(params=['alone'one', 'with_systemtime'])
+def testconfig_sections(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')
- config.add_section(section)
- config.set(section, 'counters', '%s:test' % request.param)
return config
+(a)pytest.fixture(params=['System'tem', '2'], ids=['counter:System',
'counter:2'])
+def testconfig(request, testconfig_sections):
+ testconfig_sections.set('global', 'crash_debug', 'yes')
+ testconfig_sections.add_section(Globals.section)
+ testconfig_sections.set(Globals.section, 'counters', '%s:test' %
request.param)
+ return testconfig_sections
+
+
@pytest.fixture
def expected_output():
- return
repeat(r'\<\<\<winperf_(if|phydisk|processor|test)\>\>\>'
- r'|\d+\.\d{2} \d+ \d+'
- r'|\d+ instances\:( [^ ]+)+'
- r'|\-?\d+( \d+)+ [\w\(\)]+')
+ re_str =
(r'\<\<\<winperf_(if|phydisk|processor|test)\>\>\>'
+ r'|\d+\.\d{2} \d+ \d+'
+ r'|\d+ instances\:( [^ ]+)+'
+ r'|\-?\d+( \d+)+ [\w\(\)]+')
+ if not Globals.alone:
+ re_str += r'|' + re.escape(r'<<<systemtime>>>')
+ r'|\d+'
+ return repeat(re_str)
+
def test_section_winperf(request, testconfig, expected_output, actual_output,