mirror of
https://github.com/iflytek/skillhub.git
synced 2026-10-10 03:27:54 +00:00
test(deploy): wait for final PostgreSQL process
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
This commit is contained in:
parent
e7d43891ce
commit
b5607dfa05
1 changed files with 7 additions and 1 deletions
|
|
@ -40,7 +40,13 @@ fi
|
|||
wait_for_postgres() {
|
||||
local container="$1"
|
||||
for _ in $(seq 1 30); do
|
||||
if docker exec "$container" pg_isready -U skillhub -d skillhub >/dev/null 2>&1; then
|
||||
# docker-entrypoint.sh briefly starts a temporary PostgreSQL process while
|
||||
# initializing a fresh cluster. Wait until PID 1 is the final server so a
|
||||
# successful readiness probe cannot race with that temporary shutdown.
|
||||
if docker exec "$container" sh -ec \
|
||||
'test "$(cat /proc/1/comm)" = postgres' >/dev/null 2>&1 \
|
||||
&& docker exec "$container" psql -U skillhub -d skillhub -Atqc \
|
||||
'SELECT 1' >/dev/null 2>&1; then
|
||||
return 0
|
||||
fi
|
||||
sleep 1
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue