Skip to content

Commit

Permalink
Add mssql db check before starting tests (#16134)
Browse files Browse the repository at this point in the history
* do a db check for mssql before starting tests

* add health check integration

* fix health check
  • Loading branch information
aneesh-joseph committed May 28, 2021
1 parent 9c80bfb commit a7e1f7a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions scripts/ci/docker-compose/backend-mssql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ services:
- BACKEND=mssql
- AIRFLOW__CORE__SQL_ALCHEMY_CONN=mssql+pyodbc://sa:Airflow123@mssql:1433/master?driver=ODBC+Driver+17+for+SQL+Server
- AIRFLOW__CELERY__RESULT_BACKEND=db+mssql+pyodbc://sa:Airflow123@mssql:1433/master?driver=ODBC+Driver+17+for+SQL+Server
- AIRFLOW__CORE__EXECUTOR=LocalExecutor
depends_on:
- mssql
mssql:
condition: service_healthy
mssql:
image: mcr.microsoft.com/mssql/server:${MSSQL_VERSION}
environment:
Expand All @@ -32,7 +34,8 @@ services:
volumes:
- mssql-db-volume:/var/opt/mssql
healthcheck:
test: ["CMD", "sqlcmd", "-S", "localhost", "-U", "sa", "-P", "$SA_PASSWORD", "-Q", "SELECT 1"]
test: ["CMD", "/opt/mssql-tools/bin/sqlcmd", "-S", "localhost",
"-U", "sa", "-P", "Airflow123", "-Q", "SELECT 1"]
interval: 10s
timeout: 10s
retries: 10
Expand Down
3 changes: 2 additions & 1 deletion scripts/in_container/check_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,11 @@ function check_db_backend {
check_service "MySQL" "run_nc mysql 3306" "${MAX_CHECK}"
elif [[ ${BACKEND} == "mssql" ]]; then
check_service "MSSQL" "run_nc mssql 1433" "${MAX_CHECK}"
check_service "MSSQL Login Check" "airflow db check" "${MAX_CHECK}"
elif [[ ${BACKEND} == "sqlite" ]]; then
return
else
echo "Unknown backend. Supported values: [postgres,mysql,sqlite]. Current value: [${BACKEND}]"
echo "Unknown backend. Supported values: [postgres,mysql,mssql,sqlite]. Current value: [${BACKEND}]"
exit 1
fi
}
Expand Down

0 comments on commit a7e1f7a

Please sign in to comment.