Files @ 1bb9f7ac1072
Branch filter:

Location: majic-ansible-roles/roles/web_server/tests/test_client.py

branko
MAR-112: Added alternate SMTP port:

- Updated mail_server role to deploy firewall rules that include redirection
from TCP port 27 to TCP port 25.
- Updated documentation to include references to the additional port.
- Updated tests to cover the new functionality.
import testinfra.utils.ansible_runner


testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
    '.molecule/ansible_inventory').get_hosts('client1')


def test_connectivity(Command, Sudo):
    """
    Tests connectivity to the web server (ports that should be reachable).
    """

    with Sudo():

        for server in ["parameters-mandatory",
                       "parameters-optional"]:
            # HTTP, HTTPS.
            for port in [80, 443]:

                ping = Command('hping3 -S -p %d -c 1 %s' % (port, server))
                assert ping.rc == 0