Skip to content

Commit 69db038

Browse files
authored
ci: fix docker replica mode test
1 parent 7195cdb commit 69db038

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

.github/workflows/replication-test.yml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,22 +78,22 @@ jobs:
7878
7979
- name: Verify initial replication
8080
run: |
81-
# Query source data & MyDuck data
81+
# Query source data
82+
SCHEMA=""
8283
if [ "${{ matrix.source }}" = "mysql" ]; then
8384
docker exec source-db mysql -uroot -proot test \
8485
-e "SELECT * FROM items ORDER BY id;" | tee source_data.csv
85-
86-
docker exec myduck psql -U postgres -h 127.0.0.1 \
87-
-c "\COPY (SELECT * FROM test.items ORDER BY id) TO STDOUT WITH CSV;" | tee myduck_data.csv
88-
86+
SCHEMA=test
8987
else
9088
docker exec source-db psql -U postgres -h 127.0.0.1 test \
9189
-c "\COPY (SELECT * FROM items ORDER BY id) TO STDOUT WITH CSV;" | tee source_data.csv
92-
93-
docker exec myduck psql -U postgres -h 127.0.0.1 \
94-
-c "\COPY (SELECT * FROM items ORDER BY id) TO STDOUT WITH CSV;" | tee myduck_data.csv
90+
SCHEMA=public
9591
fi
9692
93+
# Query MyDuck data
94+
docker exec myduck psql -U postgres -h 127.0.0.1 \
95+
-c "\COPY (SELECT * FROM ${SCHEMA}.items ORDER BY id) TO STDOUT WITH CSV;" | tee myduck_data.csv
96+
9797
# Compare data using DuckDB
9898
duckdb --csv -c "
9999
CREATE TABLE source AS FROM 'source_data.csv';
@@ -113,20 +113,23 @@ jobs:
113113
- name: Test replication of new data
114114
run: |
115115
# Insert new data in source
116+
SCHEMA=""
116117
if [ "${{ matrix.source }}" = "mysql" ]; then
117118
docker exec source-db mysql -uroot -proot test \
118119
-e "INSERT INTO items VALUES (3, 'test3');"
120+
SCHEMA=test
119121
else
120122
docker exec source-db psql -U postgres test \
121123
-c "INSERT INTO items VALUES (3, 'test3');"
124+
SCHEMA=public
122125
fi
123126
124127
# Wait for replication
125128
sleep 5
126129
127130
# Verify new data was replicated
128131
docker exec myduck psql -t -U postgres -h 127.0.0.1 -c \
129-
"SELECT COUNT(*) FROM items WHERE id = 3;" | tr -d ' ' | tee count.txt
132+
"SELECT COUNT(*) FROM ${SCHEMA}.items WHERE id = 3;" | tr -d ' ' | tee count.txt
130133
131134
if grep -q '^1$' count.txt; then
132135
echo 'Replication of new data verified successfully'
@@ -138,4 +141,4 @@ jobs:
138141
- name: Cleanup
139142
if: always()
140143
run: |
141-
docker rm -f source-db myduck || true
144+
docker rm -f source-db myduck || true

0 commit comments

Comments
 (0)