mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 09:40:20 +00:00
Use the grains
fixture
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
bb4d8e25ed
commit
11dd2ec8a9
1 changed files with 18 additions and 26 deletions
|
@ -7,17 +7,13 @@ pytestmark = [
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def test_system_config(salt_cli, salt_minion):
|
@pytest.mark.usefixtures("salt_minion")
|
||||||
|
def test_system_config(grains):
|
||||||
"""
|
"""
|
||||||
Test system config
|
Test system config
|
||||||
"""
|
"""
|
||||||
get_family = salt_cli.run("grains.get", "os_family", minion_tgt=salt_minion.id)
|
if grains["os_family"] == "RedHat":
|
||||||
assert get_family.returncode == 0
|
if grains["osfinger"] in (
|
||||||
get_finger = salt_cli.run("grains.get", "osfinger", minion_tgt=salt_minion.id)
|
|
||||||
assert get_finger.returncode == 0
|
|
||||||
|
|
||||||
if get_family.data == "RedHat":
|
|
||||||
if get_finger.data in (
|
|
||||||
"CentOS Stream-8",
|
"CentOS Stream-8",
|
||||||
"CentOS Linux-8",
|
"CentOS Linux-8",
|
||||||
"CentOS Stream-9",
|
"CentOS Stream-9",
|
||||||
|
@ -27,24 +23,20 @@ def test_system_config(salt_cli, salt_minion):
|
||||||
"VMware Photon OS-5",
|
"VMware Photon OS-5",
|
||||||
"Amazon Linux-2023",
|
"Amazon Linux-2023",
|
||||||
):
|
):
|
||||||
ret = subprocess.call(
|
expected_retcode = 0
|
||||||
"systemctl show -p ${config} salt-minion.service", shell=True
|
|
||||||
)
|
|
||||||
assert ret == 0
|
|
||||||
else:
|
else:
|
||||||
ret = subprocess.call(
|
expected_retcode = 1
|
||||||
"systemctl show -p ${config} salt-minion.service", shell=True
|
ret = subprocess.call(
|
||||||
)
|
"systemctl show -p ${config} salt-minion.service", shell=True
|
||||||
assert ret == 1
|
)
|
||||||
|
assert ret == expected_retcode
|
||||||
|
|
||||||
elif "Debian" in get_family.stdout:
|
elif grains["os_family"] == "Debian":
|
||||||
if "Debian-9" in get_finger.stdout:
|
if grains["osfinger"] == "Debian-9":
|
||||||
ret = subprocess.call(
|
expected_retcode = 1
|
||||||
"systemctl show -p ${config} salt-minion.service", shell=True
|
|
||||||
)
|
|
||||||
assert ret == 1
|
|
||||||
else:
|
else:
|
||||||
ret = subprocess.call(
|
expected_retcode = 0
|
||||||
"systemctl show -p ${config} salt-minion.service", shell=True
|
ret = subprocess.call(
|
||||||
)
|
"systemctl show -p ${config} salt-minion.service", shell=True
|
||||||
assert ret == 0
|
)
|
||||||
|
assert ret == expected_retcode
|
||||||
|
|
Loading…
Add table
Reference in a new issue