Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: correct replication table filtering test #345

Merged
merged 1 commit into from
Jan 2, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading