xoxys.kernel/molecule/rocky8/tests/test_default.py
Robert Kaussow bd94ae2034
All checks were successful
continuous-integration/drone/push Build is passing
feat: add test for Rocky Linux 8 (#1)
Co-authored-by: Robert Kaussow <xoxys@rknet.org>
Co-committed-by: Robert Kaussow <xoxys@rknet.org>
2022-01-26 21:10:00 +01:00

34 lines
927 B
Python

import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ["MOLECULE_INVENTORY_FILE"]
).get_hosts("all")
def test_sysctl_file(host):
sysctl = host.file("/etc/sysctl.d/local.conf")
assert sysctl.exists
assert sysctl.user == "root"
assert sysctl.group == "root"
assert sysctl.mode == 0o644
def test_modprobe_file(host):
modprobe = host.file("/etc/modprobe.d/custom.conf")
assert modprobe.exists
assert modprobe.user == "root"
assert modprobe.group == "root"
assert modprobe.mode == 0o644
assert modprobe.contains("install usb-storage /bin/true")
assert modprobe.contains("blacklist firewire-core")
def test_coredump_config(host):
assert host.file("/etc/sysctl.d/dump.conf").exists
assert host.file("/etc/security/limits.d/dump.conf").exists
assert host.file("/etc/profile.d/dump.sh").exists