From 8fb5fa218accb68d4ced565e7ee3e7fcf524e473 Mon Sep 17 00:00:00 2001 From: NGPixel Date: Sun, 5 Jul 2020 21:08:39 -0400 Subject: [PATCH] fix: cypress db wait for connection --- dev/cypress/ci-setup.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/dev/cypress/ci-setup.sh b/dev/cypress/ci-setup.sh index 5f388b3e..d3162559 100644 --- a/dev/cypress/ci-setup.sh +++ b/dev/cypress/ci-setup.sh @@ -2,6 +2,10 @@ case $TEST_MATRIX in postgres) echo "Using PostgreSQL..." docker run -d -p 5432:5432 --name db --network="host" -e "POSTGRES_PASSWORD=Password123!" -e "POSTGRES_USER=wiki" -e "POSTGRES_DB=wiki" postgres:11 + while ! docker exec db psql -U wiki -d wiki -c "SELECT 1" &> /dev/null ; do + echo "Waiting for database connection..." + sleep 2 + done docker run -d -p 3000:3000 --name wiki --network="host" -e "DB_TYPE=postgres" -e "DB_HOST=localhost" -e "DB_PORT=5432" -e "DB_NAME=wiki" -e "DB_USER=wiki" -e "DB_PASS=Password123!" requarks/wiki:canary-2.5.67 ;; mysql) @@ -24,9 +28,11 @@ mariadb) ;; mssql) echo "Using MS SQL Server..." - docker run -d -p 1433:1433 --name db --network="host" -e "SA_PASSWORD=Password123!" -e "ACCEPT_EULA=wiki" -e "MYSQL_PASSWORD=Password123!" -e "MYSQL_DATABASE=wiki" mcr.microsoft.com/mssql/server:2019-latest - sleep 30 - docker exec db /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "Password123!" -Q 'CREATE DATABASE wiki' + docker run -d -p 1433:1433 --name db --network="host" -e "SA_PASSWORD=Password123!" -e "ACCEPT_EULA=Y" mcr.microsoft.com/mssql/server:2019-latest + while ! docker exec db /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "Password123!" -Q 'CREATE DATABASE wiki' &> /dev/null ; do + echo "Waiting for database connection..." + sleep 2 + done docker run -d -p 3000:3000 --name wiki --network="host" -e "DB_TYPE=mssql" -e "DB_HOST=localhost" -e "DB_PORT=1433" -e "DB_NAME=wiki" -e "DB_USER=SA" -e "DB_PASS=Password123!" requarks/wiki:canary-2.5.67 ;; sqlite)