From 28467e68a5df6abad06a0ecec96c7ac0a47bd2d8 Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Tue, 20 Dec 2016 11:21:47 +0200 Subject: [PATCH] - Added config validity test. --- tests/test_syslog_forward.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/test_syslog_forward.py b/tests/test_syslog_forward.py index 706db06..38b391d 100644 --- a/tests/test_syslog_forward.py +++ b/tests/test_syslog_forward.py @@ -3,9 +3,18 @@ from testinfra.utils.ansible_runner import AnsibleRunner testinfra_hosts = AnsibleRunner('.molecule/ansible_inventory').get_hosts('all') -def test_syslog_forward(Service, SystemInfo): +def test_syslog_forward_service(Service, SystemInfo): if SystemInfo.type == 'openbsd': assert Service('syslogd').is_running elif SystemInfo.type == 'linux' and SystemInfo.distribution in ['debian', 'ubuntu']: assert Service('rsyslog').is_running + + +def test_syslog_forwarding_syntax(SystemInfo, Command, Sudo): + if SystemInfo.type == 'linux' and SystemInfo.distribution in ['debian', + 'ubuntu']: + with Sudo(): + command = Command('rsyslogd -N1') + assert command.rc == 0 + assert 'End of config validation run' in command.stderr -- GitLab