diff --git a/roles/mail_server/molecule/default/tests/test_client2.py b/roles/mail_server/molecule/default/tests/test_client2.py index 6e70bb5b6f92d63bef532b68cc34b2eb078661dd..8ba434f92df4d0ed687a20a10349c278bef357f0 100644 --- a/roles/mail_server/molecule/default/tests/test_client2.py +++ b/roles/mail_server/molecule/default/tests/test_client2.py @@ -250,19 +250,27 @@ def test_sieve_authentication_requires_tls(host): assert command.rc == 0 -def test_connectivity(host): +@pytest.mark.parametrize("server", [ + "parameters-mandatory", + "parameters-optional" +]) +@pytest.mark.parametrize("port", [ + 25, + 26, + 27, + 587, + 143, + 993, + 4190 +]) +def test_connectivity(host, server, port): """ Tests connectivity to the mail server (ports that should be reachable). """ with host.sudo(): - - for server in ["parameters-mandatory", - "parameters-optional"]: - for port in [25, 26, 27, 587, 143, 993, 4190]: - - ping = host.run('hping3 -S -p %d -c 1 %s' % (port, server)) - assert ping.rc == 0 + ping = host.run('hping3 -S -p %s -c 1 %s', str(port), server) + assert ping.rc == 0 def test_port_forwarding(host):