Module: check_mk
Branch: master
Commit: 2e391d074fb4d8903eadb807e86626a1408766c9
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2e391d074fb4d8…
Author: Jukka Aro <ja(a)mathias-kettner.de>
Date: Wed May 16 15:36:09 2018 +0200
Win-agent: test section uptime followed by systemtime
Check that the uptime 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 uptime section.
Change-Id: I0338aa529212654f46f914f385d860070f8ee4fc
---
agents/windows/it/test_section_uptime.py | 28 +++++++++++++++++++++-------
1 file changed, 21 insertions(+), 7 deletions(-)
diff --git a/agents/windows/it/test_section_uptime.py
b/agents/windows/it/test_section_uptime.py
index 5387123..15fa075 100644
--- a/agents/windows/it/test_section_uptime.py
+++ b/agents/windows/it/test_section_uptime.py
@@ -2,26 +2,40 @@
# -*- coding: utf-8; py-indent-offset: 4 -*-
import os
import pytest
+import re
from remote import actual_output, config, remotetest, wait_agent, write_config
+class Globals(object):
+ section = 'uptime'
+ alone = True
+
+
@pytest.fixture
def testfile():
return os.path.basename(__file__)
-(a)pytest.fixture
-def testconfig(config):
- section = 'uptime'
- 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 [r'<<<uptime>>>', r'\d+']
+ expected = [r'<<<%s>>>' % Globals.section, r'\d+']
+ if not Globals.alone:
+ expected += [re.escape(r'<<<systemtime>>>'),
r'\d+']
+ return expected
-def test_section_uptime(testconfig, expected_output, actual_output, testfile):
- remotetest(expected_output, actual_output, testfile)
+def test_section_uptime(request, testconfig, expected_output, actual_output,
+ testfile):
+ # request.node.name gives test name
+ remotetest(expected_output, actual_output, testfile, request.node.name)