Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 1/trixie/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ docker_process_init_files() {
# ie: docker_process_sql -f my-file.sql
# ie: docker_process_sql <my-file.sql
docker_process_sql() {
local query_runner=( psql -v ON_ERROR_STOP=1 --username "$IVORYSQL_USER" -p 5866 --no-password --no-psqlrc )
local query_runner=( psql -v ON_ERROR_STOP=1 --username "$IVORYSQL_USER" -p "${PGPORT:-5866}" --no-password --no-psqlrc )
if [ -n "$IVORYSQL_DB" ]; then
query_runner+=( --dbname "$IVORYSQL_DB" )
fi
Expand Down
2 changes: 1 addition & 1 deletion 3/bookworm/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ docker_process_init_files() {
# ie: docker_process_sql -f my-file.sql
# ie: docker_process_sql <my-file.sql
docker_process_sql() {
local query_runner=( psql -v ON_ERROR_STOP=1 --username "$IVORYSQL_USER" -p 5866 --no-password --no-psqlrc )
local query_runner=( psql -v ON_ERROR_STOP=1 --username "$IVORYSQL_USER" -p "${PGPORT:-5866}" --no-password --no-psqlrc )
if [ -n "$IVORYSQL_DB" ]; then
query_runner+=( --dbname "$IVORYSQL_DB" )
fi
Expand Down
2 changes: 1 addition & 1 deletion 3/trixie/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ docker_process_init_files() {
# ie: docker_process_sql -f my-file.sql
# ie: docker_process_sql <my-file.sql
docker_process_sql() {
local query_runner=( psql -v ON_ERROR_STOP=1 --username "$IVORYSQL_USER" -p 5866 --no-password --no-psqlrc )
local query_runner=( psql -v ON_ERROR_STOP=1 --username "$IVORYSQL_USER" -p "${PGPORT:-5866}" --no-password --no-psqlrc )
if [ -n "$IVORYSQL_DB" ]; then
query_runner+=( --dbname "$IVORYSQL_DB" )
fi
Expand Down
2 changes: 1 addition & 1 deletion 3/ubi8/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ docker_process_init_files() {
# ie: docker_process_sql -f my-file.sql
# ie: docker_process_sql <my-file.sql
docker_process_sql() {
local query_runner=( psql -v ON_ERROR_STOP=1 --username "$IVORYSQL_USER" -p 5866 --no-password --no-psqlrc )
local query_runner=( psql -v ON_ERROR_STOP=1 --username "$IVORYSQL_USER" -p "${PGPORT:-5866}" --no-password --no-psqlrc )
if [ -n "$IVORYSQL_DB" ]; then
query_runner+=( --dbname "$IVORYSQL_DB" )
fi
Expand Down
2 changes: 1 addition & 1 deletion 4/bookworm/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ docker_process_init_files() {
# ie: docker_process_sql -f my-file.sql
# ie: docker_process_sql <my-file.sql
docker_process_sql() {
local query_runner=( psql -v ON_ERROR_STOP=1 --username "$IVORYSQL_USER" -p 5866 --no-password --no-psqlrc )
local query_runner=( psql -v ON_ERROR_STOP=1 --username "$IVORYSQL_USER" -p "${PGPORT:-5866}" --no-password --no-psqlrc )
if [ -n "$IVORYSQL_DB" ]; then
query_runner+=( --dbname "$IVORYSQL_DB" )
fi
Expand Down
2 changes: 1 addition & 1 deletion 4/trixie/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ docker_process_init_files() {
# ie: docker_process_sql -f my-file.sql
# ie: docker_process_sql <my-file.sql
docker_process_sql() {
local query_runner=( psql -v ON_ERROR_STOP=1 --username "$IVORYSQL_USER" -p 5866 --no-password --no-psqlrc )
local query_runner=( psql -v ON_ERROR_STOP=1 --username "$IVORYSQL_USER" -p "${PGPORT:-5866}" --no-password --no-psqlrc )
if [ -n "$IVORYSQL_DB" ]; then
query_runner+=( --dbname "$IVORYSQL_DB" )
fi
Expand Down
2 changes: 1 addition & 1 deletion 4/ubi8/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ docker_process_init_files() {
# ie: docker_process_sql -f my-file.sql
# ie: docker_process_sql <my-file.sql
docker_process_sql() {
local query_runner=( psql -v ON_ERROR_STOP=1 --username "$IVORYSQL_USER" -p 5866 --no-password --no-psqlrc )
local query_runner=( psql -v ON_ERROR_STOP=1 --username "$IVORYSQL_USER" -p "${PGPORT:-5866}" --no-password --no-psqlrc )
if [ -n "$IVORYSQL_DB" ]; then
query_runner+=( --dbname "$IVORYSQL_DB" )
fi
Expand Down
2 changes: 1 addition & 1 deletion 5/bookworm/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ docker_process_init_files() {
# ie: docker_process_sql -f my-file.sql
# ie: docker_process_sql <my-file.sql
docker_process_sql() {
local query_runner=( psql -v ON_ERROR_STOP=1 --username "$IVORYSQL_USER" -p 5866 --no-password --no-psqlrc )
local query_runner=( psql -v ON_ERROR_STOP=1 --username "$IVORYSQL_USER" -p "${PGPORT:-5866}" --no-password --no-psqlrc )
if [ -n "$IVORYSQL_DB" ]; then
query_runner+=( --dbname "$IVORYSQL_DB" )
fi
Expand Down
2 changes: 1 addition & 1 deletion 5/trixie/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ docker_process_init_files() {
# ie: docker_process_sql -f my-file.sql
# ie: docker_process_sql <my-file.sql
docker_process_sql() {
local query_runner=( psql -v ON_ERROR_STOP=1 --username "$IVORYSQL_USER" -p 5866 --no-password --no-psqlrc )
local query_runner=( psql -v ON_ERROR_STOP=1 --username "$IVORYSQL_USER" -p "${PGPORT:-5866}" --no-password --no-psqlrc )
if [ -n "$IVORYSQL_DB" ]; then
query_runner+=( --dbname "$IVORYSQL_DB" )
fi
Expand Down
2 changes: 1 addition & 1 deletion 5/ubi8/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ docker_process_init_files() {
# ie: docker_process_sql -f my-file.sql
# ie: docker_process_sql <my-file.sql
docker_process_sql() {
local query_runner=( psql -v ON_ERROR_STOP=1 --username "$IVORYSQL_USER" -p 5866 --no-password --no-psqlrc )
local query_runner=( psql -v ON_ERROR_STOP=1 --username "$IVORYSQL_USER" -p "${PGPORT:-5866}" --no-password --no-psqlrc )
if [ -n "$IVORYSQL_DB" ]; then
query_runner+=( --dbname "$IVORYSQL_DB" )
fi
Expand Down
2 changes: 1 addition & 1 deletion docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ docker_process_init_files() {
# ie: docker_process_sql -f my-file.sql
# ie: docker_process_sql <my-file.sql
docker_process_sql() {
local query_runner=( psql -v ON_ERROR_STOP=1 --username "$IVORYSQL_USER" -p 5866 --no-password --no-psqlrc )
local query_runner=( psql -v ON_ERROR_STOP=1 --username "$IVORYSQL_USER" -p "${PGPORT:-5866}" --no-password --no-psqlrc )
if [ -n "$IVORYSQL_DB" ]; then
query_runner+=( --dbname "$IVORYSQL_DB" )
fi
Expand Down
40 changes: 40 additions & 0 deletions tests/entrypoint-port.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env bash
# Run from the repository root: bash tests/entrypoint-port.sh
# Stub only database commands; exercise every shipped entrypoint function.
set -Eeuo pipefail
for script in docker-entrypoint.sh [0-9]*/*/docker-entrypoint.sh; do
for port in '' 6543; do
(
source "$script"
export PGPORT="$port" IVORYSQL_USER=test IVORYSQL_DB=test PGDATA=/tmp/test
expected_port=${PGPORT:-5866}
psql() {
while (( $# )); do
if [[ $1 == -p ]]; then
[[ $2 == "$expected_port" ]] || {
echo "$script: SQL client uses $2 instead of $expected_port" >&2
return 1
}
return
fi
shift
done
echo 'SQL client port missing' >&2
return 1
}
pg_ctl() {
while (( $# )); do
if [[ $1 == -o ]]; then
[[ " $2 " == *" -p $expected_port "* ]]
return
fi
shift
done
return 1
}
docker_temp_server_start postgres
docker_process_sql --command 'SELECT 1'
)
done
done
echo 'All entrypoint client/server port checks passed'