2019-05-26 17:43:37 +02:00
|
|
|
import os
|
|
|
|
|
|
|
|
import testinfra.utils.ansible_runner
|
|
|
|
|
2019-10-19 16:35:24 +02:00
|
|
|
import warnings
|
2021-06-07 22:15:14 +02:00
|
|
|
|
2019-10-19 16:35:24 +02:00
|
|
|
warnings.filterwarnings("ignore", category=DeprecationWarning)
|
|
|
|
|
2019-05-26 17:43:37 +02:00
|
|
|
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
2021-06-07 22:15:14 +02:00
|
|
|
os.environ['MOLECULE_INVENTORY_FILE']
|
|
|
|
).get_hosts('all')
|
2019-05-26 17:43:37 +02:00
|
|
|
|
|
|
|
|
2019-10-19 16:35:24 +02:00
|
|
|
def test_yum_cron_is_installed(host):
|
|
|
|
yum = host.package("yum-cron")
|
|
|
|
assert yum.is_installed
|
|
|
|
|
|
|
|
|
|
|
|
def test_yum_cron_running_and_enabled(host):
|
|
|
|
yum = host.service("yum-cron")
|
|
|
|
assert yum.is_running
|
|
|
|
assert yum.is_enabled
|
|
|
|
|
2019-05-26 17:43:37 +02:00
|
|
|
|
2019-10-19 16:35:24 +02:00
|
|
|
def test_yum_cron_custom_cronjob(host):
|
|
|
|
custom = host.file("/etc/cron.d/x-yum")
|
|
|
|
assert custom.exists
|