Unify docker usage in tests

This commit is contained in:
Ayaz Salikhov
2022-01-22 00:46:20 +02:00
parent 2fee7b754c
commit 12b618c5da
17 changed files with 104 additions and 146 deletions

View File

@@ -48,14 +48,14 @@ def test_start_notebook(
LOGGER.info(
f"Test that the start-notebook launches the {expected_command} server from the env {env} ..."
)
c = container.run(
running_container = container.run_detached(
tty=True,
environment=env,
command=["start-notebook.sh"],
)
# sleeping some time to let the server start
time.sleep(3)
logs = c.logs(stdout=True).decode("utf-8")
logs = running_container.logs().decode("utf-8")
LOGGER.debug(logs)
# checking that the expected command is launched
assert (
@@ -84,12 +84,12 @@ def test_tini_entrypoint(
https://superuser.com/questions/632979/if-i-know-the-pid-number-of-a-process-how-can-i-get-its-name
"""
LOGGER.info(f"Test that {command} is launched as PID {pid} ...")
c = container.run(
running_container = container.run_detached(
tty=True,
command=["start.sh"],
)
# Select the PID 1 and get the corresponding command
cmd = c.exec_run(f"ps -p {pid} -o comm=")
cmd = running_container.exec_run(f"ps -p {pid} -o comm=")
output = cmd.output.decode("utf-8").strip("\n")
assert "ERROR" not in output
assert "WARNING" not in output