From 224d159d1701a9f002ddf67484fdda3cafbfcf21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Tue, 21 Nov 2023 17:21:34 +0100 Subject: [PATCH] feat: support timezones in mariadb Pass timezone info to the runtime container to make MariaDB pick it up: ```bash $ docker run -it -e "TZ=CET" jbergstroem/mariadb-alpine ``` PR: https://github.com/jbergstroem/mariadb-alpine/pull/266 --- Dockerfile | 2 +- test/config.sh | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index de1941f..898bdd0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,7 +21,7 @@ LABEL \ SHELL ["/bin/ash", "-euo", "pipefail", "-c"] RUN \ - apk add --no-cache mariadb=${APK_VERSION} mariadb-client=${APK_VERSION} && \ + apk add --no-cache "tzdata>=2023c-r1" mariadb=${APK_VERSION} mariadb-client=${APK_VERSION} && \ TO_KEEP=$(echo " \ etc/ssl/certs/ca-certificates.crt$ \ usr/bin/mariadb$ \ diff --git a/test/config.sh b/test/config.sh index 65a0e96..fc06c38 100644 --- a/test/config.sh +++ b/test/config.sh @@ -61,6 +61,15 @@ test_custom_charset_collation() { stop "${name}" } +test_custom_timezone() { + local name="${suite_name}_timezone" + ip=$(create "${name}" false "-e SKIP_INNODB=1 -e MYSQL_DATABASE=bar -e TZ=CET") + # timezone is set properly + ret=$(${CLIENT} -h "${ip}" -N --database=bar -e "SELECT GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'system_time_zone';") + assert_equals "CET" "${ret}" + stop "${name}" +} + test_mount_custom_config() { local name="${suite_name}_mount_custom_config" ip=$(create "${name}" false "-e SKIP_INNODB=1 -v $(pwd)/fixtures/user-my.cnf:/etc/my.cnf.d/my.cnf")