Run tests in parallel

This commit is contained in:
Ayaz Salikhov
2022-02-14 17:29:24 +03:00
parent 2e39b99522
commit e2f5d5b3b9
6 changed files with 24 additions and 21 deletions

View File

@@ -7,7 +7,7 @@ import logging
import pytest # type: ignore
import requests
from conftest import TrackedContainer
from conftest import TrackedContainer, find_free_port
LOGGER = logging.getLogger(__name__)
@@ -15,11 +15,11 @@ LOGGER = logging.getLogger(__name__)
def test_cli_args(container: TrackedContainer, http_client: requests.Session) -> None:
"""Container should respect notebook server command line args
(e.g., disabling token security)"""
host_port = find_free_port()
running_container = container.run_detached(
command=["start-notebook.sh", "--NotebookApp.token=''"],
ports={"8888/tcp": None},
ports={"8888/tcp": host_port},
)
host_port = container.get_host_port("8888/tcp")
resp = http_client.get(f"http://localhost:{host_port}")
resp.raise_for_status()
logs = running_container.logs().decode("utf-8")
@@ -37,11 +37,11 @@ def test_unsigned_ssl(
"""Container should generate a self-signed SSL certificate
and notebook server should use it to enable HTTPS.
"""
host_port = find_free_port()
running_container = container.run_detached(
environment=["GEN_CERT=yes"],
ports={"8888/tcp": None},
ports={"8888/tcp": host_port},
)
host_port = container.get_host_port("8888/tcp")
# NOTE: The requests.Session backing the http_client fixture does not retry
# properly while the server is booting up. An SSL handshake error seems to
# abort the retry logic. Forcing a long sleep for the moment until I have