-
Notifications
You must be signed in to change notification settings - Fork 479
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a concept for the test for extensions
- Loading branch information
1 parent
0ea62c7
commit 70db6fe
Showing
6 changed files
with
77 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
set -ex | ||
cd "$(dirname ${0})" | ||
/usr/local/pgsql/lib/pgxs/src/makefiles/../../src/test/regress/pg_regress --inputdir=./ --bindir='/usr/local/pgsql/bin' --inputdir=test --use-existing --dbname=contrib_regression bit btree cast copy halfvec hnsw_bit hnsw_halfvec hnsw_sparsevec hnsw_vector ivfflat_bit ivfflat_halfvec ivfflat_vector sparsevec vector_type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
set -ex | ||
cd "$(dirname ${0})" | ||
/usr/local/pgsql/lib/pgxs/src/makefiles/../../src/test/regress/pg_regress --inputdir=./ --bindir='/usr/local/pgsql/bin' --use-existing --dbname=contrib_regression plv8 plv8-errors scalar_args inline json startup_pre startup varparam json_conv jsonb_conv window guc es6 arraybuffer composites currentresource startup_perms bytea find_function_perms memory_limits reset show array_spread regression dialect bigint procedure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
set -ex | ||
cd "$(dirname ${0})" | ||
/usr/local/pgsql/lib/pgxs/src/makefiles/../../src/test/regress/pg_regress --inputdir=./ --bindir='/usr/local/pgsql/bin' --use-existing --dbname=contrib_regression extension tables unit binary unicode prefix units time temperature functions language_functions round derived compare aggregate iec custom crosstab convert |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/bin/bash | ||
set -eux -o pipefail | ||
if [ -z ${OLDTAG+x} ] || [ -z ${NEWTAG+x} ] || [ -z "${OLDTAG}" ] || [ -z "${NEWTAG}" ]; then | ||
echo OLDTAG and NEWTAG must be defined | ||
exit 1 | ||
fi | ||
export PGUSER=cloud_admin | ||
export PGPASSWORD=cloud_admin | ||
export PGHOST=127.0.0.1 | ||
export PGPORT=55433 | ||
export PGDATABASE=postgres | ||
docker volume prune -f | ||
function wait_for_ready { | ||
while ! docker compose logs compute_is_ready | grep -q "accepting connections"; do | ||
sleep 1 | ||
done | ||
} | ||
function create_extensions() { | ||
for ext in ${1}; do | ||
echo "CREATE EXTENSION IF NOT EXISTS ${ext};" | ||
done | psql -X -v ON_ERROR_STOP=1 | ||
} | ||
EXTENSIONS='[ | ||
{"extname": "plv8", "extdir": "plv8-src"}, | ||
{"extname": "vector", "extdir": "pgvector-src"}, | ||
{"extname": "unit", "extdir": "postgresql-unit-src"} | ||
]' | ||
EXTNAMES=$(echo ${EXTENSIONS} | jq -r '.[].extname' | paste -sd ' ' -) | ||
TAG=${NEWTAG} docker compose up --build -d | ||
wait_for_ready | ||
create_extensions "${EXTNAMES}" | ||
query="select json_object_agg(extname,extversion) from pg_extension where extname in ('${EXTNAMES// /','}')" | ||
new_vers=$(psql -Aqt -c "$query" ) | ||
echo $new_vers | ||
docker compose down | ||
TAG=${OLDTAG} docker compose --profile test-extensions up --build -d --force-recreate | ||
wait_for_ready | ||
# XXX this is about to be included into the image, for test only | ||
docker compose cp ext-src neon-test-extensions:/ | ||
for ext in $EXTNAMES; do | ||
echo "CREATE EXTENSION IF NOT EXISTS ${ext};" | ||
done | psql -X -v ON_ERROR_STOP=1 | ||
query="select pge.extname from pg_extension pge join (select key as extname, value as extversion from json_each_text('${new_vers}')) x on pge.extname=x.extname and pge.extversion <> x.extversion" | ||
echo $query | ||
exts=$(psql -Aqt -c "$query") | ||
if [ -z "${exts}" ]; then | ||
echo "No extensions were upgraded" | ||
else | ||
psql -c "CREATE DATABASE contrib_regression" | ||
export PGDATABASE=contrib_regression | ||
create_extensions "${exts}" | ||
TAG=${OLDTAG} docker compose down compute compute_is_ready | ||
COMPUTE_TAG=${NEWTAG} TAG=${OLDTAG} docker compose up -d --build compute compute_is_ready | ||
wait_for_ready | ||
for ext in ${exts}; do | ||
echo Testing ${ext}... | ||
EXTDIR=$(echo ${EXTENSIONS} | jq -r '.[] | select(.extname=="'${ext}'") | .extdir') | ||
psql -d contrib_regression -c "\dx ${ext}" | ||
docker compose exec -e PGPASSWORD=cloud_admin neon-test-extensions sh -c /ext-src/${EXTDIR}/test-upgrade.sh | ||
psql -d contrib_regression -c "alter extension ${ext} update" | ||
psql -d contrib_regression -c "\dx ${ext}" | ||
done | ||
fi | ||
docker compose --profile test-extensions down |