Skip to content

Commit

Permalink
Add CI check for unecessary template tests
Browse files Browse the repository at this point in the history
When the regression tests output differs between PG versions we create a
template test (aka *.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.
  • Loading branch information
fabriziomello committed Oct 12, 2023
1 parent ecd88f8 commit dfce181
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 3,595 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/code_style.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,7 @@ jobs:
- name: Check for missing gitignore entries for template test files
if: always()
run: ./scripts/check_missing_gitignore_for_template_tests.sh
- name: Check for unecessary template test files
if: always()
run: ./scripts/check_unecessary_template_tests.sh

17 changes: 17 additions & 0 deletions scripts/check_unecessary_template_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

ERROR=0

for FILE in $(git ls-files | grep '\.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}
1,197 changes: 0 additions & 1,197 deletions tsl/test/expected/telemetry_stats-13.out

This file was deleted.

1,197 changes: 0 additions & 1,197 deletions tsl/test/expected/telemetry_stats-14.out

This file was deleted.

1,197 changes: 0 additions & 1,197 deletions tsl/test/expected/telemetry_stats-16.out

This file was deleted.

File renamed without changes.
1 change: 0 additions & 1 deletion tsl/test/sql/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
/modify_exclusion-*.sql
/plan_skip_scan-*.sql
/remote-copy-*sv
/telemetry_stats-*.sql
/transparent_decompression-*.sql
/transparent_decompression_ordered_index-*.sql
/merge_append_partially_compressed-*.sql
7 changes: 4 additions & 3 deletions tsl/test/sql/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ if(CMAKE_BUILD_TYPE MATCHES Debug)
transparent_decompression_join_index.sql
feature_flags.sql)

if(USE_TELEMETRY)
list(APPEND TEST_FILES telemetry_stats.sql)
endif()

if(ENABLE_MULTINODE_TESTS)
list(
APPEND
Expand Down Expand Up @@ -203,9 +207,6 @@ if(CMAKE_BUILD_TYPE MATCHES Debug)
dist_partial_agg.sql.in
dist_query.sql.in)
endif()
if(USE_TELEMETRY)
list(APPEND TEST_TEMPLATES telemetry_stats.sql.in)
endif()
endif(CMAKE_BUILD_TYPE MATCHES Debug)

# Check if PostgreSQL was compiled with JIT support
Expand Down
File renamed without changes.

0 comments on commit dfce181

Please sign in to comment.