2025-05-22 18:53:25 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
# Versions to test
|
|
|
|
|
versions=( $@ )
|
|
|
|
|
|
|
|
|
|
# If we weren't given any versions, test them all
|
|
|
|
|
if [ ${#versions[@]} -eq 0 ]
|
|
|
|
|
then
|
2025-06-18 07:03:34 +00:00
|
|
|
versions=( 9.2 9.4 9.6 10 11 12 13 14 15 16 17 )
|
2025-05-22 18:53:25 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Image tags to use
|
|
|
|
|
declare -A images=()
|
|
|
|
|
images["9.2"]='9.2'
|
2025-06-18 07:03:34 +00:00
|
|
|
images["9.3"]='9.3'
|
|
|
|
|
images["9.4"]='9.4'
|
|
|
|
|
images["9.5"]='9.5'
|
2025-05-22 18:53:25 +00:00
|
|
|
images["9.6"]='9.6-bullseye'
|
|
|
|
|
images["10"]='10-bullseye'
|
|
|
|
|
images["11"]='11-bookworm'
|
|
|
|
|
images["12"]='12-bookworm'
|
|
|
|
|
images["13"]='13-bookworm'
|
|
|
|
|
images["14"]='14-bookworm'
|
|
|
|
|
images["15"]='15-bookworm'
|
|
|
|
|
images["16"]='16-bookworm'
|
|
|
|
|
images["17"]='17-bookworm'
|
|
|
|
|
|
|
|
|
|
declare -A results=()
|
|
|
|
|
|
|
|
|
|
# Make sure everything's down to start with
|
|
|
|
|
docker compose down
|
|
|
|
|
|
|
|
|
|
# Make sure our agent container is up to date
|
|
|
|
|
docker compose build agent
|
|
|
|
|
|
|
|
|
|
for version in "${versions[@]}"
|
|
|
|
|
do
|
|
|
|
|
echo
|
|
|
|
|
echo "Testing: PostgreSQL ${version}"
|
|
|
|
|
|
|
|
|
|
# Specify the version we're testing against
|
|
|
|
|
export PGTAG="${images["$version"]}"
|
|
|
|
|
|
|
|
|
|
# Start the containers
|
|
|
|
|
docker compose up --exit-code-from=agent agent
|
|
|
|
|
rc=$?
|
|
|
|
|
|
|
|
|
|
results["$version"]=$rc
|
|
|
|
|
|
|
|
|
|
# Destroy the containers
|
|
|
|
|
docker compose down
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
echo
|
|
|
|
|
echo
|
|
|
|
|
for v in "${versions[@]}"
|
|
|
|
|
do
|
|
|
|
|
case "${results["$v"]}" in
|
|
|
|
|
0) msg="OK" ;;
|
|
|
|
|
1) msg="Query failure detected" ;;
|
|
|
|
|
18) msg="Docker image error: 18" ;;
|
|
|
|
|
*) msg="Unexpected error: ${results["$v"]}" ;;
|
|
|
|
|
esac
|
|
|
|
|
echo "$v -> $msg"
|
|
|
|
|
done
|