diff --git a/roles/common/molecule/default/tests/test_maintenance_from_disallowed_client.py b/roles/common/molecule/default/tests/test_maintenance_from_disallowed_client.py index ac7376367f4b1818eda5530b6f2e5979ad412a1a..4b9a9877a98c942b48fe432db8e814bb2013852f 100644 --- a/roles/common/molecule/default/tests/test_maintenance_from_disallowed_client.py +++ b/roles/common/molecule/default/tests/test_maintenance_from_disallowed_client.py @@ -23,8 +23,10 @@ def test_ssh_connectivity(host, target_host): with host.sudo(): - ping = host.run('hping3 -S -p 22 -c 1 %s', '%s' % target_host) - assert ping.rc == 0 + scan = host.run('nmap -p 22 -oG - %s', target_host) + + assert scan.rc == 0 + assert "Ports: 22/open/tcp//ssh" in scan.stdout @pytest.mark.parametrize("target_host", parameters_mandatory_hosts) @@ -35,8 +37,10 @@ def test_http_connectivity_allowed(host, target_host): with host.sudo(): - ping = host.run('hping3 -S -p 80 -c 1 %s', target_host) - assert ping.rc == 0 + scan = host.run('nmap -p 80 -oG - %s', target_host) + + assert scan.rc == 0 + assert "Ports: 80/open/tcp//http" in scan.stdout @pytest.mark.parametrize("target_host", parameters_optional_hosts) @@ -47,5 +51,7 @@ def test_http_connectivity_disallowed(host, target_host): with host.sudo(): - ping = host.run('hping3 -S -p 80 -c 1 %s', target_host) - assert ping.rc == 1 + scan = host.run('nmap -p 80 -oG - %s', target_host) + + assert scan.rc == 0 + assert "Ports: 80/filtered/tcp//http" in scan.stdout