From 2c31a37b0ff2dc422ecbd1b83beeb387e96211f7 2025-02-03 14:52:19 From: Branko Majic Date: 2025-02-03 14:52:19 Subject: [PATCH] MAR-243: Drop inventory hostname usage from web_server tests. --- diff --git a/roles/web_server/molecule/default/tests/test_default.py b/roles/web_server/molecule/default/tests/test_default.py index d0655271391fdbcd83506a872986b2c075628609..0e71fa8cd29e9f743f2c13a244f8fdeb1fd64908 100644 --- a/roles/web_server/molecule/default/tests/test_default.py +++ b/roles/web_server/molecule/default/tests/test_default.py @@ -342,7 +342,7 @@ def test_tls_enabled(host): Tests if TLS has been enabled. """ - hostname = host.ansible.get_variables()['inventory_hostname'] + hostname = host.run('hostname').stdout.strip() tls = host.run('curl https://%s/', hostname) assert tls.rc == 0 @@ -353,7 +353,7 @@ def test_https_enforcement(host): Tests if HTTPS is being enforced. """ - hostname = host.ansible.get_variables()['inventory_hostname'] + hostname = host.run('hostname').stdout.strip() https_enforcement = host.run('curl -I http://%s/', hostname) diff --git a/roles/web_server/molecule/default/tests/test_mandatory.py b/roles/web_server/molecule/default/tests/test_mandatory.py index ef696b0e9e21fe47b6aaaccdece07c68c0722e41..e1a18702cfb267f1450dc38060b8a887d1df1eff 100644 --- a/roles/web_server/molecule/default/tests/test_mandatory.py +++ b/roles/web_server/molecule/default/tests/test_mandatory.py @@ -56,7 +56,7 @@ def test_default_vhost_index_page(host): Tests content of default vhost index page. """ - hostname = host.ansible.get_variables()['inventory_hostname'] + hostname = host.run('hostname').stdout.strip() page = host.run('curl https://%s/', hostname) assert page.rc == 0 diff --git a/roles/web_server/molecule/default/tests/test_optional.py b/roles/web_server/molecule/default/tests/test_optional.py index 63d1fb1f5b14d73767688d3e0500807dad3a8d9b..c27babeb45c753521819794c7906bc073793cfd0 100644 --- a/roles/web_server/molecule/default/tests/test_optional.py +++ b/roles/web_server/molecule/default/tests/test_optional.py @@ -56,7 +56,7 @@ def test_default_vhost_index_page(host): Tests content of default vhost index page. """ - hostname = host.ansible.get_variables()['inventory_hostname'] + hostname = host.run('hostname').stdout.strip() page = host.run('curl https://%s/', hostname) assert page.rc == 0 @@ -70,7 +70,7 @@ def test_environment_indicator(host): Tests if environment indicator is applied correctly. """ - hostname = host.ansible.get_variables()['inventory_hostname'] + hostname = host.run('hostname').stdout.strip() page = host.run('curl https://%s/' % hostname)