diff --git a/all-spark-notebook/test/test_spark_notebooks.py b/all-spark-notebook/test/test_spark_notebooks.py index 1a1d8528..cd949b8e 100644 --- a/all-spark-notebook/test/test_spark_notebooks.py +++ b/all-spark-notebook/test/test_spark_notebooks.py @@ -32,8 +32,8 @@ def test_nbconvert(container, test_file): command=["start.sh", "bash", "-c", command], ) rv = c.wait(timeout=timeout_ms / 10 + 10) - assert rv == 0 or rv["StatusCode"] == 0, f"Command {command} failed" logs = c.logs(stdout=True).decode("utf-8") LOGGER.debug(logs) + assert rv == 0 or rv["StatusCode"] == 0, f"Command {command} failed" expected_file = f"{output_dir}/{test_file}.md" assert expected_file in logs, f"Expected file {expected_file} not generated" diff --git a/base-notebook/test/test_package_managers.py b/base-notebook/test/test_package_managers.py index 49b9bc8a..1355a9c1 100644 --- a/base-notebook/test/test_package_managers.py +++ b/base-notebook/test/test_package_managers.py @@ -28,7 +28,7 @@ def test_package_manager(container, package_manager, version_arg): ) rv = c.wait(timeout=5) logs = c.logs(stdout=True).decode("utf-8") + LOGGER.debug(logs) assert ( rv == 0 or rv["StatusCode"] == 0 ), f"Package manager {package_manager} not working" - LOGGER.debug(logs) diff --git a/base-notebook/test/test_start_container.py b/base-notebook/test/test_start_container.py index e1231e19..32760185 100644 --- a/base-notebook/test/test_start_container.py +++ b/base-notebook/test/test_start_container.py @@ -21,9 +21,9 @@ def test_start_notebook(container, http_client, env, expected_server): ) c = container.run(tty=True, environment=env, command=["start-notebook.sh"]) resp = http_client.get("http://localhost:8888") - assert resp.status_code == 200, "Server is not listening" logs = c.logs(stdout=True).decode("utf-8") LOGGER.debug(logs) + assert resp.status_code == 200, "Server is not listening" assert ( f"Executing the command: jupyter {expected_server}" in logs ), f"Not the expected command (jupyter {expected_server}) was launched" diff --git a/datascience-notebook/test/test_julia.py b/datascience-notebook/test/test_julia.py index 5fa631a8..887764ed 100644 --- a/datascience-notebook/test/test_julia.py +++ b/datascience-notebook/test/test_julia.py @@ -15,5 +15,5 @@ def test_julia(container): command = "julia --version" cmd = running_container.exec_run(command) output = cmd.output.decode("utf-8") - assert cmd.exit_code == 0, f"Command {command} failed {output}" LOGGER.debug(output) + assert cmd.exit_code == 0, f"Command {command} failed {output}" diff --git a/minimal-notebook/test/test_nbconvert.py b/minimal-notebook/test/test_nbconvert.py index 6e2675eb..eff7fd0e 100644 --- a/minimal-notebook/test/test_nbconvert.py +++ b/minimal-notebook/test/test_nbconvert.py @@ -32,8 +32,8 @@ def test_nbconvert(container, test_file, output_format): command=["start.sh", "bash", "-c", command], ) rv = c.wait(timeout=30) - assert rv == 0 or rv["StatusCode"] == 0, f"Command {command} failed" logs = c.logs(stdout=True).decode("utf-8") LOGGER.debug(logs) + assert rv == 0 or rv["StatusCode"] == 0, f"Command {command} failed" expected_file = f"{output_dir}/{test_file}.{output_format}" assert expected_file in logs, f"Expected file {expected_file} not generated" diff --git a/pyspark-notebook/test/test_spark.py b/pyspark-notebook/test/test_spark.py index 09d74481..f9b7e7e1 100644 --- a/pyspark-notebook/test/test_spark.py +++ b/pyspark-notebook/test/test_spark.py @@ -25,6 +25,6 @@ def test_pyspark(container): command=['start.sh', 'python', '-c', 'import pyspark'] ) rv = c.wait(timeout=30) - assert rv == 0 or rv["StatusCode"] == 0, "pyspark not in PYTHONPATH" logs = c.logs(stdout=True).decode('utf-8') LOGGER.debug(logs) + assert rv == 0 or rv["StatusCode"] == 0, "pyspark not in PYTHONPATH" diff --git a/scipy-notebook/test/test_matplotlib.py b/scipy-notebook/test/test_matplotlib.py index ac6d7ceb..a0e73af3 100644 --- a/scipy-notebook/test/test_matplotlib.py +++ b/scipy-notebook/test/test_matplotlib.py @@ -35,11 +35,11 @@ def test_matplotlib(container, test_file, expected_file, description): ) command = f"python {cont_data_dir}/{test_file}" cmd = running_container.exec_run(command) - assert cmd.exit_code == 0, f"Command {command} failed" LOGGER.debug(cmd.output.decode("utf-8")) + assert cmd.exit_code == 0, f"Command {command} failed" # Checking if the file is generated # https://stackoverflow.com/a/15895594/4413446 command = f"test -s {output_dir}/{expected_file}" cmd = running_container.exec_run(command) - assert cmd.exit_code == 0, f"Command {command} failed" LOGGER.debug(cmd.output.decode("utf-8")) + assert cmd.exit_code == 0, f"Command {command} failed" diff --git a/scipy-notebook/test/test_pandas.py b/scipy-notebook/test/test_pandas.py index 410f5023..12be2862 100644 --- a/scipy-notebook/test/test_pandas.py +++ b/scipy-notebook/test/test_pandas.py @@ -27,6 +27,6 @@ def test_pandas(container, name, command_list): command = ';'.join(command_list) c = container.run(tty=True, command=["start.sh", "python", "-c", command]) rv = c.wait(timeout=30) - assert rv == 0 or rv["StatusCode"] == 0, f"Command {command} failed" logs = c.logs(stdout=True).decode("utf-8") LOGGER.debug(logs) + assert rv == 0 or rv["StatusCode"] == 0, f"Command {command} failed" diff --git a/tagging/docker_runner.py b/tagging/docker_runner.py index ce87df51..c391e963 100644 --- a/tagging/docker_runner.py +++ b/tagging/docker_runner.py @@ -32,8 +32,8 @@ class DockerRunner: def run_simple_command(container, cmd: str, print_result: bool = True): logger.info(f"Running cmd: '{cmd}' on container: {container}") out = container.exec_run(cmd) - assert out.exit_code == 0, f"Command: {cmd} failed" result = out.output.decode("utf-8").rstrip() if print_result: logger.info(f"Command result: {result}") + assert out.exit_code == 0, f"Command: {cmd} failed" return result diff --git a/tensorflow-notebook/test/test_tensorflow.py b/tensorflow-notebook/test/test_tensorflow.py index f5a6910f..232fab0c 100644 --- a/tensorflow-notebook/test/test_tensorflow.py +++ b/tensorflow-notebook/test/test_tensorflow.py @@ -25,6 +25,6 @@ def test_tensorflow(container, name, command): LOGGER.info(f"Testing tensorflow: {name} ...") c = container.run(tty=True, command=["start.sh", "python", "-c", command]) rv = c.wait(timeout=30) - assert rv == 0 or rv["StatusCode"] == 0, f"Command {command} failed" logs = c.logs(stdout=True).decode("utf-8") LOGGER.debug(logs) + assert rv == 0 or rv["StatusCode"] == 0, f"Command {command} failed"