Module: check_mk
Branch: master
Commit: a1c029e53ee0a1f2531d12804587400e609fd276
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a1c029e53ee0a1…
Author: Jukka Aro <ja(a)mathias-kettner.de>
Date: Wed May 16 15:36:09 2018 +0200
Win-agent: test dotnet_clrmemory followed by systemtime
Check that the dotnet_clrmemory 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
dotnet_clrmemory section.
Change-Id: I6dbac788f092a48ebb090089f27cefa996b9aa68
---
agents/windows/it/test_section_dotnet_clrmemory.py | 42 ++++++++++++++--------
1 file changed, 27 insertions(+), 15 deletions(-)
diff --git a/agents/windows/it/test_section_dotnet_clrmemory.py
b/agents/windows/it/test_section_dotnet_clrmemory.py
index 2a34c56..d9c353c 100644
--- a/agents/windows/it/test_section_dotnet_clrmemory.py
+++ b/agents/windows/it/test_section_dotnet_clrmemory.py
@@ -7,23 +7,31 @@ import re
from remote import actual_output, config, remotetest, wait_agent, write_config
+class Globals(object):
+ section = 'dotnet_clrmemory'
+ alone = True
+
+
@pytest.fixture
def testfile():
return os.path.basename(__file__)
-(a)pytest.fixture
-def testconfig(config):
- section = 'dotnet_clrmemory'
- 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
@pytest.fixture
def expected_output():
- return chain([
- re.escape(r'<<<dotnet_clrmemory:sep(44)>>>'),
+ base = [
+ re.escape(r'<<<%s:sep(44)>>>' % Globals.section),
(r'AllocatedBytesPersec,Caption,Description,FinalizationSurvivors,'
r'Frequency_Object,Frequency_PerfTime,Frequency_Sys100NS,Gen0heapsize,'
r'Gen0PromotedBytesPerSec,Gen1heapsize,Gen1PromotedBytesPerSec,'
@@ -35,12 +43,16 @@ def expected_output():
r'ProcessID,PromotedFinalizationMemoryfromGen0,PromotedMemoryfromGen0,'
r'PromotedMemoryfromGen1,Timestamp_Object,Timestamp_PerfTime,'
r'Timestamp_Sys100NS')
- ],
- repeat(r'\d+,,,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,'
- r'[\w\#\.]+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,'
- r'\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+'))
-
-
-def test_section_dotnet_clrmemory(testconfig, expected_output, actual_output,
- testfile):
- remotetest(expected_output, actual_output, testfile)
+ ]
+ re_str = (r'\d+,,,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,'
+ r'[\w\#\.]+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,'
+ r'\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+,\d+')
+ if not Globals.alone:
+ re_str += r'|' + re.escape(r'<<<systemtime>>>')
+ '|\d+'
+ return chain(base, repeat(re_str))
+
+
+def test_section_dotnet_clrmemory(request, testconfig, expected_output,
+ actual_output, testfile):
+ # request.node.name gives test name
+ remotetest(expected_output, actual_output, testfile, request.node.name)