Skip to content

Commit

Permalink
test: correct replication table filtering test (#345)
Browse files Browse the repository at this point in the history
  • Loading branch information
fanyang01 authored Jan 2, 2025
1 parent 6246739 commit 98d97ec
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions .github/workflows/replication-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,19 +174,6 @@ jobs:
exit 1
fi
# Verify skipped table is empty (for MySQL-compatible databases only)
if [ "${{ matrix.source }}" != "postgres" ]; then
# Check if skip table has any rows
COUNT=$(docker exec myduck psql -t -U postgres -h 127.0.0.1 -c \
"SELECT COUNT(*) FROM ${SCHEMA}.skip;" | tr -d ' ')
if [ "$COUNT" -eq "0" ]; then
echo "Successfully verified that skipped table exists but is empty"
else
echo "Error: Skipped table 'skip' contains $COUNT rows when it should be empty"
exit 1
fi
fi
- name: Test replication of new data
run: |
# Insert new data in source
Expand Down Expand Up @@ -225,6 +212,28 @@ jobs:
# Print the logs
docker logs myduck
- name: Verify skip tables
run: |
# Verify skipped table is empty (for MySQL-compatible databases only)
if [ "${{ matrix.source }}" != "postgres" ]; then
# Check if skip table exists and has any rows
TABLE_EXISTS=$(docker exec myduck psql -t -U postgres -h 127.0.0.1 -c \
"SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '${SCHEMA}' AND table_name = 'skip';" | tr -d ' ')
if [ "$TABLE_EXISTS" -ne "0" ]; then
COUNT=$(docker exec myduck psql -t -U postgres -h 127.0.0.1 -c \
"SELECT COUNT(*) FROM ${SCHEMA}.skip;" | tr -d ' ')
if [ "$COUNT" -eq "0" ]; then
echo "Successfully verified that skipped table exists but is empty"
else
echo "Error: Skipped table 'skip' contains $COUNT rows when it should be empty"
exit 1
fi
else
echo "Successfully verified that skipped table does not exist in destination"
fi
fi
- name: Cleanup
if: always()
run: |
Expand Down

0 comments on commit 98d97ec

Please sign in to comment.