From 98f403654d48a1e52ed15c865e31df2bc1509860 Mon Sep 17 00:00:00 2001 From: pwalczysko Date: Wed, 20 Nov 2024 17:31:28 +0000 Subject: [PATCH] Add tests --- molecule/tests/test_default.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 molecule/tests/test_default.py diff --git a/molecule/tests/test_default.py b/molecule/tests/test_default.py new file mode 100644 index 00000000..b534293c --- /dev/null +++ b/molecule/tests/test_default.py @@ -0,0 +1,33 @@ +import os +import pytest +import testinfra.utils.ansible_runner + +testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( + os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') + +OMERO = '/opt/omero/server/OMERO.server/bin/omero' +OMERO_LOGIN = '-C -s localhost -u root -w omero' + + +@pytest.mark.parametrize("name", [ + 'nginx', + 'omero-server', + 'omero-web', + 'postgresql-16', +]) +def test_service_running_and_enabled(host, name): + service = host.service(name) + assert service.is_running + assert service.is_enabled + + +def test_omero_login(host): + with host.sudo('omero-server'): + host.check_output( + '/opt/omero/server/OMERO.server/bin/omero ' + 'login -C -s localhost -u root -w omero') + + +def test_omero_nginx_ssl(host): + out = host.check_output('curl -fkI https://localhost/') + assert 'Location: /webclient/' in out