diff --git a/azure-pipelines/azure-pipelines.yml b/azure-pipelines/azure-pipelines.yml index 22737c828..af30f214c 100644 --- a/azure-pipelines/azure-pipelines.yml +++ b/azure-pipelines/azure-pipelines.yml @@ -384,13 +384,15 @@ stages: displayName: docker run tdengine and checkoutput - script: | set -e - docker run -itd --network host --name mysql -e MYSQL_ALLOW_EMPTY_PASSWORD=yes mysql:8.1.0 + docker run -itd --network host --name mysql -e MYSQL_ALLOW_EMPTY_PASSWORD=yes \ + --health-cmd='mysqladmin ping -h localhost -uroot' --health-interval=5s --health-timeout=5s --health-retries=20 \ + mysql:8.1.0 bash $(System.DefaultWorkingDirectory)/examples/telemetryservice/mysql/checkoutput.sh displayName: docker run mysql and checkoutput - script: | set -e docker run -itd --network host --name sqlserver -e ACCEPT_EULA=Y -e SA_PASSWORD=Some_Strong_Password \ - --health-cmd="/opt/mssql-tools/bin/sqlcmd -U sa -P Some_Strong_Password -Q 'select name from sys.databases'" --health-interval=10s --health-timeout=5s --health-retries=5 \ + --health-cmd="/opt/mssql-tools/bin/sqlcmd -U sa -P Some_Strong_Password -Q 'select name from sys.databases'" --health-interval=5s --health-timeout=5s --health-retries=20 \ mcr.microsoft.com/mssql/server:2022-CU7-ubuntu-20.04 bash $(System.DefaultWorkingDirectory)/examples/telemetryservice/sqlserver/checkoutput.sh displayName: docker run sqlserver and checkoutput diff --git a/examples/telemetryservice/mysql/checkoutput.sh b/examples/telemetryservice/mysql/checkoutput.sh index 00044cf25..15878b2f6 100644 --- a/examples/telemetryservice/mysql/checkoutput.sh +++ b/examples/telemetryservice/mysql/checkoutput.sh @@ -1,19 +1,10 @@ #!/bin/bash MySQLOutput=2 -sleep 3 -for i in {1..50} -do - output=$(docker exec mysql mysql -u root -e "Show databases;" 2>&1 | grep 'ERROR' | wc -l) - #echo $output - if [[ $output -eq 0 ]] - then - echo $output - break - elif [[ $i -eq 50 ]] - then - exit 1 - fi +echo "Waiting for MySQL to be ready..." +while [[ "$(docker inspect --format='{{.State.Health.Status}}' mysql)" != "healthy" ]]; do + sleep 5 done +echo "MySQL is ready." # init MySQL Table docker exec mysql mysql -u root \