Skip to content
Snippets Groups Projects
Commit 2a6c00fd authored by nimrod's avatar nimrod
Browse files

- Added config check and status tests.

parent efb7acd1
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,7 @@ from testinfra.utils.ansible_runner import AnsibleRunner
testinfra_hosts = AnsibleRunner('.molecule/ansible_inventory').get_hosts('all')
def test_ntp(Service, SystemInfo):
def test_ntp_service(Service, SystemInfo):
if SystemInfo.type == 'openbsd':
service = Service('ntpd')
elif SystemInfo.type == 'linux':
......@@ -16,3 +16,24 @@ def test_ntp(Service, SystemInfo):
assert service.is_enabled
except NotImplementedError:
pass
def test_ntp_config(SystemInfo, Command):
if SystemInfo.type == 'openbsd' or (
SystemInfo.type == 'linux' and
SystemInfo.codename not in ['jessie', 'stretch', 'xenial']):
command = Command('ntpd -n')
assert command.rc == 0
assert 'configuration OK' in command.stderr
def test_ntp_status(SystemInfo, Command):
if SystemInfo.type == 'openbsd':
assert Command('ntpctl -s status').rc == 0
assert 'peers valid' in Command('ntpctl -s status').stdout
elif SystemInfo.type == 'linux' and SystemInfo.codename in [
'jessie', 'stretch', 'xenial'
]:
command = Command('timedatectl status')
assert command.rc == 0
assert 'Network time on: yes' in command.stdout
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment