Debian Codegraph @

ansible_collections/community/zabbix/molecule/zabbix_repo/tests/test_default.py

raw
1 import os
2 import pytest
3 from pathlib import Path
4
5
6 import testinfra.utils.ansible_runner
7
8 testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
9 os.environ["MOLECULE_INVENTORY_FILE"]
10 ).get_hosts("all")
11
12
13 def test_zabbix_manage_repo_installed(host):
14 os = host.system_info.distribution
15 if os in ["rocky"]:
16 result = host.ansible("command", "yum update -y", check=False, become=True)["rc"]
17 elif os in ["debian", "ubuntu"]:
18 result = host.ansible("command", "apt update", check=False, become=True)["rc"]
19 elif os in ["opensuse-leap"]:
20 result = host.ansible("command", "zypper refresh", check=False, become=True)["rc"]
21 assert result == 0