Skip to content

Commit 98d97ec

Browse files
authored
test: correct replication table filtering test (#345)
1 parent 6246739 commit 98d97ec

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

.github/workflows/replication-test.yml

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -174,19 +174,6 @@ jobs:
174174
exit 1
175175
fi
176176
177-
# Verify skipped table is empty (for MySQL-compatible databases only)
178-
if [ "${{ matrix.source }}" != "postgres" ]; then
179-
# Check if skip table has any rows
180-
COUNT=$(docker exec myduck psql -t -U postgres -h 127.0.0.1 -c \
181-
"SELECT COUNT(*) FROM ${SCHEMA}.skip;" | tr -d ' ')
182-
if [ "$COUNT" -eq "0" ]; then
183-
echo "Successfully verified that skipped table exists but is empty"
184-
else
185-
echo "Error: Skipped table 'skip' contains $COUNT rows when it should be empty"
186-
exit 1
187-
fi
188-
fi
189-
190177
- name: Test replication of new data
191178
run: |
192179
# Insert new data in source
@@ -225,6 +212,28 @@ jobs:
225212
# Print the logs
226213
docker logs myduck
227214
215+
- name: Verify skip tables
216+
run: |
217+
# Verify skipped table is empty (for MySQL-compatible databases only)
218+
if [ "${{ matrix.source }}" != "postgres" ]; then
219+
# Check if skip table exists and has any rows
220+
TABLE_EXISTS=$(docker exec myduck psql -t -U postgres -h 127.0.0.1 -c \
221+
"SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '${SCHEMA}' AND table_name = 'skip';" | tr -d ' ')
222+
223+
if [ "$TABLE_EXISTS" -ne "0" ]; then
224+
COUNT=$(docker exec myduck psql -t -U postgres -h 127.0.0.1 -c \
225+
"SELECT COUNT(*) FROM ${SCHEMA}.skip;" | tr -d ' ')
226+
if [ "$COUNT" -eq "0" ]; then
227+
echo "Successfully verified that skipped table exists but is empty"
228+
else
229+
echo "Error: Skipped table 'skip' contains $COUNT rows when it should be empty"
230+
exit 1
231+
fi
232+
else
233+
echo "Successfully verified that skipped table does not exist in destination"
234+
fi
235+
fi
236+
228237
- name: Cleanup
229238
if: always()
230239
run: |

0 commit comments

Comments
 (0)