From 427fa1044930160a95611dd22a0c091d7928397f Mon Sep 17 00:00:00 2001 From: Panna ABDUL HAKIM - Adaltas Date: Mon, 13 May 2024 15:26:43 +0200 Subject: [PATCH] fix(db): docker test entrypoint threshold timeout failed --- packages/db/env/mysql/docker-compose.yml | 17 ++++++----------- packages/db/env/mysql/entrypoint.sh | 6 ------ 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/packages/db/env/mysql/docker-compose.yml b/packages/db/env/mysql/docker-compose.yml index a3059b169..e22bbd626 100644 --- a/packages/db/env/mysql/docker-compose.yml +++ b/packages/db/env/mysql/docker-compose.yml @@ -4,10 +4,8 @@ services: build: . container_name: nikita_db_mysql_nodejs depends_on: - - mysql - # Not fully working for now, waiting is implemented inside entrypoint.sh - # mysql: - # condition: service_healthy + mysql: + condition: service_healthy environment: NIKITA_TEST_MODULE: /nikita/packages/db/env/mysql/test.coffee image: nikita_db_mysql_nodejs @@ -17,17 +15,14 @@ services: - ../../../../:/nikita mysql: container_name: nikita_db_mysql_db - # To avoid an error in the latest versions: ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded - command: --default-authentication-plugin=caching_sha2_password environment: MYSQL_ROOT_PASSWORD: rootme expose: - "3306" - # healthcheck: - # test: "bash -c 'echo > /dev/tcp/mysql/3306'" - # interval: 1s - # timeout: 1s - # retries: 20 + healthcheck: + test: ["CMD", "mysqladmin" ,"ping", "-h", "mysql"] + timeout: 20s + retries: 10 image: mysql:latest # logging: # driver: none diff --git a/packages/db/env/mysql/entrypoint.sh b/packages/db/env/mysql/entrypoint.sh index 018af69a6..12cca174b 100755 --- a/packages/db/env/mysql/entrypoint.sh +++ b/packages/db/env/mysql/entrypoint.sh @@ -10,12 +10,6 @@ . ~/.bashrc # Start ssh daemon sudo /usr/sbin/sshd -# Wait until MySQL is ready -i=0; until echo > /dev/tcp/mysql/3306; do - [[ i -eq 10 ]] && >&2 echo 'Docker not yet started after 10s' && exit 1 - ((i++)) - sleep 1 -done # Test execution if test -t 0; then # We have TTY, so probably an interactive container...