salt/pkg/tests/integration/test_systemd_config.py
Pedro Algarvio 11dd2ec8a9 Use the grains fixture
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-11-10 18:14:26 +00:00

42 lines
1.1 KiB
Python

import subprocess
import pytest
pytestmark = [
pytest.mark.skip_on_windows(reason="Linux test only"),
]
@pytest.mark.usefixtures("salt_minion")
def test_system_config(grains):
"""
Test system config
"""
if grains["os_family"] == "RedHat":
if grains["osfinger"] in (
"CentOS Stream-8",
"CentOS Linux-8",
"CentOS Stream-9",
"Fedora Linux-36",
"VMware Photon OS-3",
"VMware Photon OS-4",
"VMware Photon OS-5",
"Amazon Linux-2023",
):
expected_retcode = 0
else:
expected_retcode = 1
ret = subprocess.call(
"systemctl show -p ${config} salt-minion.service", shell=True
)
assert ret == expected_retcode
elif grains["os_family"] == "Debian":
if grains["osfinger"] == "Debian-9":
expected_retcode = 1
else:
expected_retcode = 0
ret = subprocess.call(
"systemctl show -p ${config} salt-minion.service", shell=True
)
assert ret == expected_retcode