Files @ 605cdbaf9717
Branch filter:

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

branko
MAR-163: Attach noqa directives to task names (if skipping is applicable on task level) for better uniformity:

- This way the indentation of comment describing the directive can
always be on the same level everywhere (irrespective of how the rest
of task arguments are listed).
import os

import testinfra.utils.ansible_runner


testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
    os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('client')


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

    with host.sudo():

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

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