timescaledb/scripts/test_functions.inc
Mats Kindahl 0bc3f0b55a Factor out repair test from update test
In order to implement repair tests, changes are made to the
`constraint_check` table to simulate a broken dependency, which
requires the constraints on that table to be dropped. This means that
the repair runs without constraints, and a bug in the update test could
potentially not get caught.

This commit fixes this by factoring out the repair tests from the
update tests and run them as a separate pass. This means that the
contraints are not dropped in the update tests and bugs there will be
caught.

In addition, some bash functions are factored out into a separate file
to avoid duplication.
2021-03-17 17:57:44 +01:00

40 lines
773 B
Bash

#!/usr/bin/env bash
SCRIPT_DIR=$(dirname $0)
# Run tests given as arguments.
#
# Options:
# -r Run repair tests as a separate pass (optional)
# -vN Use version N of the update tests (required)
run_tests() (
export TEST_VERSION
export TEST_REPAIR=false
OPTIND=1
while getopts "v:r" opt;
do
case $opt in
v)
TEST_VERSION=v$OPTARG
;;
r)
TEST_REPAIR=true
;;
esac
done
shift $((OPTIND-1))
export TAGS="$@"
bash ${SCRIPT_DIR}/test_updates.sh
if [[ "$TEST_REPAIR" = "true" ]]; then
bash ${SCRIPT_DIR}/test_repairs.sh
fi
EXIT_CODE=$?
if [ $EXIT_CODE -ne 0 ]; then
exit $EXIT_CODE
fi
)