From cfb7fd6ca1924003a435b99c21df73af9db6bbcb Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Fri, 13 May 2022 02:59:40 +0300 Subject: [PATCH] [TMP] Add test to check if image is freshly built --- base-notebook/Dockerfile | 1 + base-notebook/test-file.txt | 1 + tests/base-notebook/units/unit_check_file.py | 8 ++++++++ 3 files changed, 10 insertions(+) create mode 100644 base-notebook/test-file.txt create mode 100644 tests/base-notebook/units/unit_check_file.py diff --git a/base-notebook/Dockerfile b/base-notebook/Dockerfile index 7943cbad..7a2aebc2 100644 --- a/base-notebook/Dockerfile +++ b/base-notebook/Dockerfile @@ -103,6 +103,7 @@ RUN mkdir "/home/${NB_USER}/work" && \ # Do all this in a single RUN command to avoid duplicating all of the # files across image layers when the permissions change COPY --chown="${NB_UID}:${NB_GID}" initial-condarc "${CONDA_DIR}/.condarc" +COPY --chown="${NB_UID}:${NB_GID}" test-file.txt /tmp/test-file.txt WORKDIR /tmp RUN set -x && \ arch=$(uname -m) && \ diff --git a/base-notebook/test-file.txt b/base-notebook/test-file.txt new file mode 100644 index 00000000..bd83801f --- /dev/null +++ b/base-notebook/test-file.txt @@ -0,0 +1 @@ +test-content diff --git a/tests/base-notebook/units/unit_check_file.py b/tests/base-notebook/units/unit_check_file.py new file mode 100644 index 00000000..ecc00719 --- /dev/null +++ b/tests/base-notebook/units/unit_check_file.py @@ -0,0 +1,8 @@ +# Copyright (c) Jupyter Development Team. +# Distributed under the terms of the Modified BSD License. + +from pathlib import Path + +file = Path("/tmp/test-file.txt") +assert file.exists() +assert file.read_text() == "test-content\n"