diff --git a/Dockerfiles/backend.Dockerfile b/Dockerfiles/backend.Dockerfile index a98474321..6b0d639b0 100644 --- a/Dockerfiles/backend.Dockerfile +++ b/Dockerfiles/backend.Dockerfile @@ -49,7 +49,12 @@ ENV PYTHONPATH /code ################### FROM base as test RUN pip3 install -r /code/tests/requirements-test.txt -RUN apk add mariadb-client + +# The version of mariadb-client should match the version of the mariadb server +# Because of how alpine works, this is how to pin a version. However, it can break if this branch is removed from alpine +# https://superuser.com/questions/1055060/how-to-install-a-specific-package-version-in-alpine +# https://pkgs.alpinelinux.org/packages?name=mariadb-client&branch=v3.19&repo=&arch=x86_64&origin=&flagged=&maintainer= +RUN apk add mariadb-client=~10.11 --repository https://dl-cdn.alpinelinux.org/alpine/v3.19/main/ # Switch to the user USER $USERNAME diff --git a/SPRINTLOG.md b/SPRINTLOG.md index 05c86da58..3fd3ce53f 100644 --- a/SPRINTLOG.md +++ b/SPRINTLOG.md @@ -464,3 +464,4 @@ _Nothing merged during this sprint_ - Change the error raised upon attempt to download data after a password reset to an AuthenticationError to avoid getting an alert ([#1571](https://github.com/ScilifelabDataCentre/dds_web/pull/1571)) - Filter out the MaintenanceModeException from the logs ([#1573](https://github.com/ScilifelabDataCentre/dds_web/pull/1573)) - Bugfix: Quick and dirty change to prevent `dds ls --tree` from failing systematically ([#1575](https://github.com/ScilifelabDataCentre/dds_web/pull/1575) +- Update backend Dockerfile to pin a fixed version of mariadb-client ([#1581](https://github.com/ScilifelabDataCentre/dds_web/pull/1581) diff --git a/tests/conftest.py b/tests/conftest.py index a9d05709b..608c40032 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -103,9 +103,25 @@ def fill_basic_db(db): def new_test_db(uri): dbname = uri[uri.rindex("/") + 1 :] dbname_base = DATABASE_URI_BASE[DATABASE_URI_BASE.rindex("/") + 1 :] - dump_args = ["mysqldump", "-h", "db", "-u", "root", f"-p{mysql_root_password}", dbname_base] - load_args = ["mysql", "-h", "db", "-u", "root", f"-p{mysql_root_password}", dbname] - proc1 = subprocess.run(dump_args, capture_output=True) + dump_args = [ + "mariadb-dump", + "-h", + "db", + "-u", + "root", + f"-p{mysql_root_password}", + dbname_base, + ] + load_args = [ + "mariadb", + "-h", + "db", + "-u", + "root", + f"-p{mysql_root_password}", + dbname, + ] + proc1 = subprocess.run(dump_args, stdout=subprocess.PIPE) proc2 = subprocess.run(load_args, input=proc1.stdout, capture_output=True)