From 60d31fc636bbdd045f96dd2f7517c81b1b1fea68 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Tue, 28 Aug 2018 10:48:34 -0700 Subject: [PATCH] Test puppet is installed on base We need to be able to install puppet in our base ansible as part of the transition from puppet to other management. Test using testinfra that our base ansible playbook does install puppet. Change-Id: I3a080a0717483a0885fefb329a168dd438eb9854 --- testinfra/test_base.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/testinfra/test_base.py b/testinfra/test_base.py index df5854d0b6..550190dfcd 100644 --- a/testinfra/test_base.py +++ b/testinfra/test_base.py @@ -37,6 +37,24 @@ def test_exim_is_installed(host): assert cmd.rc == 0 +def test_puppet(host): + # We only install puppet on trusty, xenial and centos 7 + if (host.system_info.codename in ['trusty', 'xenial'] or + host.system_info.distribution in ['centos']): + # Package name differs depending on puppet release version + # just check one version of puppet is installed. + puppet = host.package("puppet") + puppet_agent = host.package("puppet-agent") + assert puppet.is_installed or puppet_agent.is_installed + service = host.service("puppet") + assert not service.is_running + assert not service.is_enabled + else: + puppet = host.package("puppet") + puppet_agent = host.package("puppet-agent") + assert not puppet.is_installed and not puppet_agent.is_installed + + def test_iptables(host): rules = host.iptables.rules() rules = [x.strip() for x in rules]