This commit is contained in:
@@ -8,6 +8,7 @@ trap 'PG_WORKING_DIR=$restore_root postgres-cleanup >/dev/null 2>&1 || true; pg_
|
||||
|
||||
export LOCAL_DIR="$tmp_root/local"
|
||||
export PG_DATABASE=postgres
|
||||
export PG_SHARED_PRELOAD_LIBRARIES=''
|
||||
mkdir -p "$LOCAL_DIR"
|
||||
|
||||
log notice "test case: normalize-backup rejects output inside input backup"
|
||||
|
||||
@@ -5,7 +5,7 @@ HECTIC_NAMESPACE=test-db-tool-postgres-init-busy-socket
|
||||
PG_WORKING_DIR=$(mktemp -d)
|
||||
export PG_WORKING_DIR PG_DATABASE=testdb PG_PORT=5432 PG_SHARED_PRELOAD_LIBRARIES=''
|
||||
|
||||
trap 'pg_harness_stop; rm -rf "$PG_WORKING_DIR"' EXIT INT TERM
|
||||
trap 'postgres-cleanup >/dev/null 2>&1 || true; pg_harness_stop; rm -rf "$PG_WORKING_DIR"' EXIT INT TERM
|
||||
|
||||
log notice "setup: creating initial postgres cluster"
|
||||
if ! postgres-init; then
|
||||
@@ -26,17 +26,18 @@ done
|
||||
[ -S "$PG_HARNESS_BUSY_SOCKET_PATH" ] || { log error "busy socket not ready"; exit 1; }
|
||||
printf '%d\n' "$PG_HARNESS_BUSY_SOCKET_PID" > "${PG_HARNESS_BUSY_SOCKET_PATH}.lock"
|
||||
|
||||
log notice "test case: postgres-init fails when socket is pre-occupied"
|
||||
log notice "test case: postgres-init reinitializes when socket is pre-occupied"
|
||||
PG_REUSE=1
|
||||
export PG_REUSE
|
||||
set +e
|
||||
postgres-init
|
||||
code=$?
|
||||
set -e
|
||||
|
||||
if [ "$code" = 0 ]; then
|
||||
log error "test failed: postgres-init exited 0 with busy socket"
|
||||
if ! postgres-init; then
|
||||
log error "test failed: postgres-init did not recover from busy socket"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log notice "test passed: exited $code"
|
||||
if ! pg_isready -h "$PG_WORKING_DIR/sock" -p 5432 >/dev/null 2>&1; then
|
||||
log error "test failed: PostgreSQL unavailable after busy-socket recovery"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log notice "test passed"
|
||||
|
||||
Reference in New Issue
Block a user