mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-15 09:22:55 +00:00
Add support for BENCHMARTK_CONNSTR
This commit is contained in:
29
docker-compose/run-tests.sh
Normal file → Executable file
29
docker-compose/run-tests.sh
Normal file → Executable file
@@ -1,12 +1,29 @@
|
||||
#!/bin/bash
|
||||
set -x
|
||||
|
||||
if [[ -v BENCHMARK_CONNSTR ]] && [[ ${BENCHMARK_CONNSTR} =~ ^postgres(ql)?:\/\/([^:]+):([^@]+)@([^:/]+):?([0-9]*)\/(.+)$ ]]; then
|
||||
export PGUSER="${BASH_REMATCH[2]}"
|
||||
export PGPASSWORD="${BASH_REMATCH[3]}"
|
||||
export PGHOST="${BASH_REMATCH[4]}"
|
||||
export PGPORT="${BASH_REMATCH[5]:-5432}"
|
||||
export PGDATABASE="${BASH_REMATCH[6]}"
|
||||
if [[ -v BENCHMARK_CONNSTR ]]; then
|
||||
uri_no_proto="${BENCHMARK_CONNSTR#postgres://}"
|
||||
uri_no_proto="${uri_no_proto#postgresql://}"
|
||||
if [[ $uri_no_proto == *\?* ]]; then
|
||||
base="${uri_no_proto%%\?*}" # before '?'
|
||||
else
|
||||
base="$uri_no_proto"
|
||||
fi
|
||||
if [[ $base =~ ^([^:]+):([^@]+)@([^:/]+):?([0-9]*)/(.+)$ ]]; then
|
||||
export PGUSER="${BASH_REMATCH[1]}"
|
||||
export PGPASSWORD="${BASH_REMATCH[2]}"
|
||||
export PGHOST="${BASH_REMATCH[3]}"
|
||||
export PGPORT="${BASH_REMATCH[4]:-5432}"
|
||||
export PGDATABASE="${BASH_REMATCH[5]}"
|
||||
echo export PGUSER="${BASH_REMATCH[1]}"
|
||||
echo export PGPASSWORD="${BASH_REMATCH[2]}"
|
||||
echo export PGHOST="${BASH_REMATCH[3]}"
|
||||
echo export PGPORT="${BASH_REMATCH[4]:-5432}"
|
||||
echo export PGDATABASE="${BASH_REMATCH[5]}"
|
||||
else
|
||||
echo "Invalid PostgreSQL base URI"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
extdir=${1}
|
||||
|
||||
Reference in New Issue
Block a user