Browse Source

fix: cypress db wait for connection

pull/2163/head
NGPixel 4 years ago
parent
commit
8fb5fa218a
1 changed files with 9 additions and 3 deletions
  1. 12
      dev/cypress/ci-setup.sh

12
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)

Loading…
Cancel
Save