Files @ 701044d4cbba
Branch filter:

Location: majic-ansible-roles/roles/mail_forwarder/tests/test_connectivity_from_client.py

branko
MAR-31: Added scaffolding for testing xmpp_server role:

- Fixed wrong default for xmpp_domains parameter (should be a list).
- Added Molecule configuration file with LDAP server, client, and two XMPP
server instances.
- Added test playbook that sets-up all servers.
- Fixed mode syntax issues (use lead zero).
- Added data required for testing.
- Added dummy file with tests.
import testinfra.utils.ansible_runner


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


def test_connectivity_from_client(Command, Sudo):
    """
    Tests connectivity towards mail forwarder servers from client
    (non-relay). Connectivity should fail for both.
    """

    with Sudo():

        ping = Command('hping3 -S -p 25 -c 1 parameters-mandatory')
        assert ping.rc != 0

        ping = Command('hping3 -S -p 25 -c 1 parameters-optional')
        assert ping.rc != 0