Files
@ 5eb7821a1e4d
Branch filter:
Location: majic-ansible-roles/roles/common/molecule/default/tests/test_maintenance_from_allowed_client.py - annotation
5eb7821a1e4d
1.4 KiB
text/x-python
MAR-218: Switch to using ldap_attrs module:
- Update invocations and syntax.
- Drop the workaround for configuring TLS on the LDAP server (should
be possible to set all relevant attributes at the same time at this
point).
- Group some invocations where it makes sense.
- Update invocations and syntax.
- Drop the workaround for configuring TLS on the LDAP server (should
be possible to set all relevant attributes at the same time at this
point).
- Group some invocations where it makes sense.
7b004fce5c8b 7b004fce5c8b 325b9d16a72b 325b9d16a72b 7b004fce5c8b 7b004fce5c8b 7b004fce5c8b 7b004fce5c8b 7b004fce5c8b 7b004fce5c8b f6bd1ff55982 f6bd1ff55982 7b004fce5c8b f6bd1ff55982 f6bd1ff55982 f6bd1ff55982 f6bd1ff55982 f6bd1ff55982 736e06e7ffd6 736e06e7ffd6 7b004fce5c8b 7b004fce5c8b 7b004fce5c8b 7b004fce5c8b 7b004fce5c8b 7b004fce5c8b 736e06e7ffd6 76debadf4dae 76debadf4dae 76debadf4dae 7b004fce5c8b 7b004fce5c8b f6bd1ff55982 736e06e7ffd6 736e06e7ffd6 7b004fce5c8b 7b004fce5c8b 7b004fce5c8b 7b004fce5c8b 7b004fce5c8b 7b004fce5c8b 736e06e7ffd6 76debadf4dae 76debadf4dae 76debadf4dae | import os
import pytest
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('client-allowed')
parameters_mandatory_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('parameters-mandatory')
parameters_optional_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('parameters-optional')
@pytest.mark.parametrize("target_host", parameters_mandatory_hosts + parameters_optional_hosts)
@pytest.mark.parametrize("ip_protocol", [4, 6])
def test_ssh_connectivity(host, target_host, ip_protocol):
"""
Test if SSH server is reachable.
"""
with host.sudo():
scan = host.run('nmap -%s -p 22 -oG - %s', str(ip_protocol), target_host)
assert scan.rc == 0
assert "Ports: 22/open/tcp//ssh" in scan.stdout
@pytest.mark.parametrize("target_host", parameters_mandatory_hosts + parameters_optional_hosts)
@pytest.mark.parametrize("ip_protocol", [4, 6])
def test_http_connectivity(host, target_host, ip_protocol):
"""
Test if HTTP server is reachable.
"""
with host.sudo():
scan = host.run('nmap -%s -p 80 -oG - %s', str(ip_protocol), target_host)
assert scan.rc == 0
assert "Ports: 80/open/tcp//http" in scan.stdout
|