diff --git a/testing/docker-compose.yml b/testing/docker-compose.yml index 5ee6f0c..3c72f98 100644 --- a/testing/docker-compose.yml +++ b/testing/docker-compose.yml @@ -7,8 +7,7 @@ services: POSTGRES_USER: "wakapi" POSTGRES_PASSWORD: "wakapi" POSTGRES_DB: "wakapi" - ports: - - "5432:5432" + network_mode: host volumes: - wakapi-postgres:/var/lib/postgresql/data @@ -19,8 +18,7 @@ services: MYSQL_PASSWORD: "wakapi" MYSQL_DATABASE: "wakapi" MYSQL_ROOT_PASSWORD: example - ports: - - "3306:3306" + network_mode: host volumes: - wakapi-mysql:/var/lib/mysql @@ -31,8 +29,7 @@ services: MARIADB_PASSWORD: "wakapi" MARIADB_DATABASE: "wakapi" MARIADB_ROOT_PASSWORD: example - ports: - - "3306:3306" + network_mode: host volumes: - wakapi-mariadb:/var/lib/mysql diff --git a/testing/run_api_tests.sh b/testing/run_api_tests.sh index e82bc7c..902dc9a 100755 --- a/testing/run_api_tests.sh +++ b/testing/run_api_tests.sh @@ -47,11 +47,20 @@ case $1 in else config="config.$1.yml" fi - sleep 5 - if [ "$1" == "mysql" ]; then - sleep 10 + db_port=0 + if [ "$1" == "postgres" ]; then + db_port=5432 + else + db_port=3306 fi + + for _ in $(seq 0 30); do + if netstat -tulpn 2>/dev/null | grep "LISTEN" | tr -s ' ' | cut -d' ' -f4 | grep -E ":$db_port$" > /dev/null; then + break + fi + sleep 1 + done ;; sqlite|*)