Skip to content

Commit

Permalink
ci: cleanup molecule tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jon4hz committed Jun 11, 2024
1 parent df824fa commit 794d552
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 38 deletions.
3 changes: 2 additions & 1 deletion molecule/zabbix_agent_tests/common/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ platforms:
networks:
- name: zabbix
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
groups:
- agent
- ${MY_MOLECULE_VERSION:-v70}
Expand Down
10 changes: 3 additions & 7 deletions molecule/zabbix_agent_tests/common/tests/common/test_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@


def test_zabbixagent_running_and_enabled(host, zabbix_agent_service):
# Find out why this is not working for linuxmint and opensuse
if host.system_info.distribution not in ["linuxmint", "opensuse", "ubuntu"]:
assert zabbix_agent_service.is_running
assert zabbix_agent_service.is_enabled
assert zabbix_agent_service.is_running
assert zabbix_agent_service.is_enabled


def test_zabbix_agent_dot_conf(zabbix_agent_conf):
Expand All @@ -32,9 +30,7 @@ def test_zabbix_include_dir(zabbix_agent_include_dir):


def test_socket(host):
# Find out why this is not working for linuxmint and opensus
if host.system_info.distribution not in ["linuxmint", "opensuse"]:
assert host.socket("tcp://0.0.0.0:10050").is_listening
assert host.socket("tcp://0.0.0.0:10050").is_listening


# def test_zabbix_package(host, zabbix_agent_package):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@

@pytest.fixture
def zabbix_agent_conf(host):
if host.system_info.distribution in ["opensuse"]:
passwd = host.file("/etc/zabbix/zabbix-agentd.conf")
else:
passwd = host.file("/etc/zabbix/zabbix_agent2.conf")

return passwd
return host.file("/etc/zabbix/zabbix_agent2.conf")


@pytest.fixture
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@

@pytest.fixture
def zabbix_agent_conf(host):
if host.system_info.distribution in ["opensuse"]:
passwd = host.file("/etc/zabbix/zabbix-agentd.conf")
else:
passwd = host.file("/etc/zabbix/zabbix_agent2.conf")

return passwd
return host.file("/etc/zabbix/zabbix_agent2.conf")


@pytest.fixture
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@

@pytest.fixture
def zabbix_agent_conf(host):
if host.system_info.distribution in ["opensuse"]:
conf_file = host.file("/etc/zabbix/zabbix-agentd.conf")
else:
conf_file = host.file("/etc/zabbix/zabbix_agentd.conf")

return conf_file
return host.file("/etc/zabbix/zabbix_agentd.conf")


@pytest.fixture
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,13 @@

@pytest.fixture
def zabbix_agent_conf(host):
if host.system_info.distribution in ["opensuse"]:
conf_file = host.file("/etc/zabbix/zabbix-agentd.conf")
else:
conf_file = host.file("/etc/zabbix/zabbix_agentd.conf")

return conf_file
return host.file("/etc/zabbix/zabbix_agentd.conf")


@pytest.fixture
def zabbix_agent_service(host):
if host.system_info.distribution == "opensuse-leap" and host.get_variables().get("zabbix_agent2", False):
return host.service("zabbix-agent2")
return host.service("zabbix-agent")


Expand Down
3 changes: 2 additions & 1 deletion molecule/zabbix_javagateway/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ platforms:
networks:
- name: zabbix
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
groups:
- ${MY_MOLECULE_VERSION:-v70}
provisioner:
Expand Down
3 changes: 2 additions & 1 deletion molecule/zabbix_proxy/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ platforms:
networks:
- name: zabbix
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
groups:
- ${MY_MOLECULE_DATABASE:-mysql}
- ${MY_MOLECULE_VERSION:-v70}
Expand Down
3 changes: 2 additions & 1 deletion molecule/zabbix_repo/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ platforms:
networks:
- name: zabbix
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
groups:
- ${MY_MOLECULE_VERSION:-v70}

Expand Down
3 changes: 2 additions & 1 deletion molecule/zabbix_server/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ platforms:
networks:
- name: zabbix
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
groups:
- ${MY_MOLECULE_DATABASE:-mysql}
- ${MY_MOLECULE_VERSION:-v70}
Expand Down
8 changes: 6 additions & 2 deletions molecule/zabbix_web/tests/test_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ def test_zabbix_package(host):
version = ansible_data['zabbix_web_version']
webserver = ansible_data['zabbix_web_http_server']

zabbix_web = host.package(f'zabbix-%s-conf' % webserver)
package_name = f'zabbix-{webserver}-conf'
if version == 7.0:
package_name = f'zabbix-{webserver}-conf-php8'

zabbix_web = host.package(package_name)
assert str(version) in zabbix_web.version


Expand All @@ -22,7 +26,7 @@ def test_zabbix_web(host):
ansible_variables = host.ansible.get_variables()
zabbix_websrv = str(ansible_variables["zabbix_web_http_server"])

if host.system_info.distribution in ["debian", "ubuntu"]:
if host.system_info.distribution in ["debian", "ubuntu", "opensuse-leap"]:
assert zabbix_web.user == "www-data"
assert zabbix_web.group == "www-data"
elif host.system_info.distribution == "centos":
Expand Down

0 comments on commit 794d552

Please sign in to comment.