Skip to content

Commit

Permalink
feat: support timezones in mariadb
Browse files Browse the repository at this point in the history
Pass timezone info to the runtime container to make MariaDB pick it up:

```bash
$ docker run -it -e "TZ=CET" jbergstroem/mariadb-alpine
```

PR: #266
  • Loading branch information
caveman99 authored and jbergstroem committed Dec 8, 2023
1 parent 896ab00 commit 224d159
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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$ \
Expand Down
9 changes: 9 additions & 0 deletions test/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 224d159

Please sign in to comment.