timescaledb/scripts/docker-run-restore-points-test.sh
Sachin 29f35da905 Fix Github CI failures
Not specifying alpine version causes libssl version
to change, which in turn cause error in downgrade tests
as well as ABI tests.
This commit also fixes shellcheck failures.
Some failing windows tests are addd to ignore list.

Co-authored-by: Lakshmi Narayanan Sreethar <lakshmi@timescale.com>
Co-authored-by: Alexander Kuzmenkov <akuzmenkov@timescale.com>
Signed-off-by: Sachin <sachin@timescale.com>
2022-12-05 18:15:21 +05:30

61 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
set -o pipefail
SCRIPT_DIR=$(dirname "$0")
BASE_DIR=${PWD}/${SCRIPT_DIR}/..
DO_CLEANUP=true
while getopts "d" opt;
do
case $opt in
d)
DO_CLEANUP=false
echo "!!Debug mode: Containers and temporary directory will be left on disk"
echo
;;
*)
echo "Unknown flag '$opt'"
exit 1
;;
esac
done
shift $((OPTIND-1))
if [ "$DO_CLEANUP" == "true" ] ; then
trap cleanup EXIT
fi
cleanup() {
# Save status here so that we can return the status of the last
# command in the script and not the last command of the cleanup
# function
status="$?"
set +e # do not exit immediately on failure in cleanup handler
docker rm -vf timescaledb-rp 2>/dev/null
echo "Exit status is $status"
exit $status
}
docker_exec() {
# Echo to stderr
>&2 echo -e "\033[1m$1\033[0m: $2"
docker exec "$1" /bin/bash -c "$2"
}
docker rm -f timescaledb-rp 2>/dev/null || true
IMAGE_NAME=rp_test TAG_NAME=latest bash "${SCRIPT_DIR}/docker-build.sh"
# The odd contortion with the BASE_DIR is necessary since SCRIPT_DIR
# is relative and --volume requires an absolute path.
docker run --env TIMESCALEDB_TELEMETRY=off -d \
--volume "${BASE_DIR}/scripts":/mnt/scripts \
--name timescaledb-rp rp_test:latest
echo "**** Testing ****"
docker_exec timescaledb-rp "mkdir /testdir"
docker_exec timescaledb-rp "chown postgres:postgres /testdir"
docker_exec timescaledb-rp "(cd /testdir; su postgres sh -c /mnt/scripts/test_restore_points.sh)"