Skip to content
Snippets Groups Projects
Verified Commit 74051ebe authored by Karel Koci's avatar Karel Koci :metal:
Browse files

selftests/lxd: add simple ping test for LXD container

The current tests check if appropriate profiles exists but not if they
actually work. The nsfarm-root has to work when container at least
starts. The problem is with nsfarm-internet. It is required to test if
it is possible to access the Internet or not with that profile. That is
exactly what this test does.
parent edac36b2
No related branches found
No related tags found
1 merge request!9Draft: selftests/lxd: add simple ping test for LXD container
"""Check if nsfarm-internet really has the Internet access.
"""
import pytest
from nsfarm.lxd import Container
from nsfarm.cli import Shell
from .test_image import BASE_IMG
@pytest.fixture(scope="module")
def container(connection):
"""Base container to be used for testing.
"""
with Container(connection, BASE_IMG) as cont:
shell = Shell(cont.pexpect())
shell.run("wait4network")
yield shell
@pytest.mark.parametrize("server", [
"217.31.205.50", # nic.cz
"nic.cz",
"turris.cz",
"repo.turris.cz",
"cloudflare.com",
])
def test_ping(container, server):
"""Simple ping to various IP addresses.
"""
container.run(f"ping -c 1 '{server}'")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment