timescaledb/scripts/check_unecessary_template_tests.sh
Fabrízio de Royes Mello f12ed00cec Add CI check for unecessary template tests
When the regression tests output differs between PG versions we create a
template test file (*.sql.in) and add several different output files for
each supported version.

Over time we support new PG version and deprecate older ones, for
example nowadays we're working on PG16 support and removed PG12 so we
need to check if we still need template files.
2023-10-13 11:32:43 -03:00

18 lines
486 B
Bash
Executable File

#!/bin/bash
ERROR=0
for FILE in $(git ls-files test/sql/*.sql.in tsl/test/sql/*.sql.in)
do
DIRNAME=$(dirname "${FILE}" | sed 's/sql/expected/g')
TESTNAME=$(basename "${FILE}" .sql.in)
if diff --from-file ${DIRNAME}/${TESTNAME}-*.out > /dev/null 2>&1; then
echo "ERROR: all template output test files are equal: \"${DIRNAME}/${TESTNAME}-*.out\""
echo "HINT: Please turn template test file \"${FILE}\" into a regular test file"
ERROR=1
fi
done
exit ${ERROR}