|
@@ -8,38 +8,32 @@ 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')
|
|
|
|
|
|
@pytest.mark.parametrize("platform", [
|
|
|
"buster",
|
|
|
"bullseye"
|
|
|
])
|
|
|
def test_ssh_connectivity(host, platform):
|
|
|
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)
|
|
|
def test_ssh_connectivity(host, target_host):
|
|
|
"""
|
|
|
Test if SSH server is reachable.
|
|
|
"""
|
|
|
|
|
|
with host.sudo():
|
|
|
|
|
|
ping = host.run('hping3 -S -p 22 -c 1 %s', 'parameters-mandatory-%s' % platform)
|
|
|
assert ping.rc == 0
|
|
|
|
|
|
ping = host.run('hping3 -S -p 22 -c 1 %s', 'parameters-optional-%s' % platform)
|
|
|
ping = host.run('hping3 -S -p 22 -c 1 %s', target_host)
|
|
|
assert ping.rc == 0
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize("platform", [
|
|
|
"buster",
|
|
|
"bullseye"
|
|
|
])
|
|
|
def test_http_connectivity(host, platform):
|
|
|
@pytest.mark.parametrize("target_host", parameters_mandatory_hosts + parameters_optional_hosts)
|
|
|
def test_http_connectivity(host, target_host):
|
|
|
"""
|
|
|
Test if HTTP server is reachable.
|
|
|
"""
|
|
|
|
|
|
with host.sudo():
|
|
|
|
|
|
ping = host.run('hping3 -S -p 80 -c 1 %s', 'parameters-mandatory-%s' % platform)
|
|
|
assert ping.rc == 0
|
|
|
|
|
|
ping = host.run('hping3 -S -p 80 -c 1 %s', 'parameters-optional-%s' % platform)
|
|
|
ping = host.run('hping3 -S -p 80 -c 1 %s', target_host)
|
|
|
assert ping.rc == 0
|