From 6ec51b4d0024d4eb1ba35cdeffd4d9eba060b5fa Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Fri, 24 Aug 2018 08:26:29 -0700 Subject: [PATCH] Add testinfra test for ntp Change-Id: If7b5215edea93d272dc1d0344839756d9f43b2ac --- testinfra/test_base.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/testinfra/test_base.py b/testinfra/test_base.py index 58d22795df..d56d07e95e 100644 --- a/testinfra/test_base.py +++ b/testinfra/test_base.py @@ -68,3 +68,15 @@ def test_iptables(host): snmp = ('-A openstack-INPUT -s %s/32 -p udp -m udp' ' --dport 161 -j ACCEPT' % ip) assert snmp in rules + + +def test_ntp(host): + package = host.package("ntp") + assert package.is_installed + + if host.system_info.distribution in ['ubuntu', 'debian']: + service = host.service("ntp") + else: + service = host.service("ntpd") + assert service.is_running + assert service.is_enabled