-
Notifications
You must be signed in to change notification settings - Fork 307
300 lines (293 loc) · 11 KB
/
dm_integration_basic.yaml
File metadata and controls
300 lines (293 loc) · 11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
name: Basic Integration Tests
on:
workflow_dispatch:
pull_request:
paths:
- 'dm/**'
- 'cmd/dm*/*'
- 'pkg/**'
- 'go.mod'
- 'go.sum'
- '.github/workflows/dm_integration_basic.yaml'
jobs:
mysql-integration:
strategy:
fail-fast: false
matrix:
mysql_version:
# MySQL 5.7 doens't enable binlogs by default and there are no easy options for enabling it.
# - '5.7'
- '8.0'
- '8.4'
- '9.7'
runs-on: ubuntu-latest
services:
mysql:
image: container-registry.oracle.com/mysql/community-server:${{ matrix.mysql_version }}
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_ROOT_HOST: "%"
MYSQL_DATABASE: test
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
tidb:
image: 'pingcap/tidb:v8.5.6'
ports:
- 4000:4000
env:
DM_MASTER_ADDR: "127.0.0.1:8261"
DM_WORKER_ADDR: "127.0.0.1:8262"
steps:
# Some steps may fail on some versions, but the end result should be the same.
# That's why we set continue-on-error and run this in multiple commands.
- name: Try to enable GTID
continue-on-error: true
run: |
mysql -h 127.0.0.1 -u root -e "SET GLOBAL ENFORCE_GTID_CONSISTENCY=ON"
mysql -h 127.0.0.1 -u root -e "SET GLOBAL gtid_mode=OFF_PERMISSIVE"
mysql -h 127.0.0.1 -u root -e "SET GLOBAL gtid_mode=ON_PERMISSIVE"
mysql -h 127.0.0.1 -u root -e "SET GLOBAL gtid_mode=ON"
- name: Check out code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
- name: Build DM binary
run: make dm
- name: Show versions
shell: bash -xe {0}
run: |
./bin/dm-master -V
./bin/dm-worker -V
./bin/dmctl -V
mysql -h 127.0.0.1 -u root -BNe "SELECT VERSION()"
mysql -h 127.0.0.1 -P 4000 -u root -BNe "SELECT VERSION()"
- name: Run DM
run: |
./bin/dm-master -master-addr ${DM_MASTER_ADDR} -log-file dm_master.log -log-format json &
./bin/dm-worker -join ${DM_MASTER_ADDR} -worker-addr ${DM_WORKER_ADDR} -log-file dm_worker.log -log-format json &
- name: Wait for DM readiness
run: |
for i in $(seq 1 30); do
if curl -sf http://${DM_MASTER_ADDR}/status > /dev/null 2>&1; then
echo "dm-master is ready after ${i}s"
break
fi
echo "waiting for dm-master... (${i}/30)"
sleep 1
done
for i in $(seq 1 30); do
if curl -sf http://${DM_WORKER_ADDR}/status > /dev/null 2>&1; then
echo "dm-worker is ready after ${i}s"
exit 0
fi
echo "waiting for dm-worker... (${i}/30)"
sleep 1
done
echo "timed out waiting for DM readiness"
exit 1
- name: Show DM status
shell: bash -xe {0}
run: |
./bin/dmctl list-member
./bin/dmctl query-status
- name: Setup source
run: ./bin/dmctl operate-source create dm/tests/integration_basic/source-mysql.yaml | tee dm_setup_source.log
- name: Start task
run: ./bin/dmctl start-task dm/tests/integration_basic/task-mysql.yaml | tee dm_setup_task.log
# Here we check that dm_setup_task.log contains a line with `"result": true`.
# Unfortunately dm_setup_task.log doesn't contain valid JSON so we can't use jq here.
# https://github.com/pingcap/tiflow/issues/11736
- name: Check task result
run: |
grep '"result": true' dm_setup_task.log
- name: Check status
run: |
./bin/dmctl operate-source show
./bin/dmctl query-status
./bin/dmctl query-status mysql-to-tidb
- name: Run input
run: mysql -h 127.0.0.1 -u root -v < dm/tests/integration_basic/setup.sql
- name: Check status
run: |
./bin/dmctl operate-source show
./bin/dmctl query-status
./bin/dmctl query-status mysql-to-tidb
- name: install mysql-tester
run: |
go install github.com/pingcap/mysql-tester/src@f2d90ea9522d30c9a8e8d70cc31c7f016ca2801f
mv ~/go/bin/src ~/go/bin/mysql-tester
- name: check logs
continue-on-error: true
run: |
jq 'select(.level == "DPANIC") | .message + ": " + .error' dm_worker.log
jq 'select(.level == "ERROR") | .message + ": " + .error' dm_worker.log
# - name: record validation test
# working-directory: ./dm/tests/integration_basic
# run: ~/go/bin/mysql-tester -record basic
# - name: show results
# working-directory: ./dm/tests/integration_basic
# run: cat r/basic.result
- name: run validation tests
working-directory: ./dm/tests/integration_basic
run: ~/go/bin/mysql-tester
- name: Check status
run: |
./bin/dmctl operate-source show
./bin/dmctl query-status
./bin/dmctl query-status mysql-to-tidb
- name: upload artifacts
uses: actions/upload-artifact@v7
with:
name: dm-logs-mysql-${{ matrix.mysql_version }}
path: dm*log
mariadb-integration:
strategy:
fail-fast: false
matrix:
mariadb_version:
- '10.11'
- '11.4'
- '11.8'
- '12.3-rc'
runs-on: ubuntu-latest
services:
tidb:
image: 'pingcap/tidb:v8.5.5'
ports:
- 4000:4000
env:
DM_MASTER_ADDR: "127.0.0.1:8261"
DM_WORKER_ADDR: "127.0.0.1:8262"
steps:
# Enabling binlogs with a services container is hard, so use docker directly.
# Note that FLUSH PRIVILEGES is done to make sure there is at least one GTID
# as otherwise the GTID format isn't detected correctly and this error happens:
# "message":"failed to update GTID set","GTID":"0-1-6",
# "error":"invalid GTID format, must UUID:interval[:interval]"
# https://github.com/pingcap/tiflow/issues/12423
- name: Run MariaDB
run: |
docker run \
-d \
--name mariadb \
-e MARIADB_ALLOW_EMPTY_ROOT_PASSWORD=1 \
-p 3306:3306 \
mariadb:${{ matrix.mariadb_version }} \
--log-bin=mariadb-bin \
--log-bin-compress=OFF \
--binlog-format=ROW \
--binlog-annotate-row-events=OFF \
--loose-binlog-legacy-event-pos=ON
until mysqladmin -h 127.0.0.1 -u root ping; do sleep 1; done
mysql -h 127.0.0.1 -u root -e "reset master"
mysql -h 127.0.0.1 -u root -e "flush privileges"
- name: Check out code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
- name: Build DM binary
run: make dm
- name: Show versions
shell: bash -xe {0}
run: |
./bin/dm-master -V
./bin/dm-worker -V
./bin/dmctl -V
mysql -h 127.0.0.1 -u root -BNe "SELECT VERSION()"
mysql -h 127.0.0.1 -P 4000 -u root -BNe "SELECT VERSION()"
- name: Run DM
run: |
./bin/dm-master -master-addr ${DM_MASTER_ADDR} -log-file dm_master.log -log-format json &
./bin/dm-worker -join ${DM_MASTER_ADDR} -worker-addr ${DM_WORKER_ADDR} -log-file dm_worker.log -log-format json &
- name: Wait for DM readiness
run: |
for i in $(seq 1 30); do
if curl -sf http://${DM_MASTER_ADDR}/status > /dev/null 2>&1; then
echo "dm-master is ready after ${i}s"
break
fi
echo "waiting for dm-master... (${i}/30)"
sleep 1
done
for i in $(seq 1 30); do
if curl -sf http://${DM_WORKER_ADDR}/status > /dev/null 2>&1; then
echo "dm-worker is ready after ${i}s"
exit 0
fi
echo "waiting for dm-worker... (${i}/30)"
sleep 1
done
echo "timed out waiting for DM readiness"
exit 1
- name: Show DM status
shell: bash -xe {0}
run: |
./bin/dmctl list-member
./bin/dmctl query-status
- name: Setup source
run: ./bin/dmctl operate-source create dm/tests/integration_basic/source-mariadb.yaml | tee dm_setup_source.log
- name: Start task
run: ./bin/dmctl start-task dm/tests/integration_basic/task-mariadb.yaml | tee dm_setup_task.log
# Here we check that dm_setup_task.log contains a line with `"result": true`.
# Unfortunately dm_setup_task.log doesn't contain valid JSON so we can't use jq here.
# https://github.com/pingcap/tiflow/issues/11736
- name: Check task result
run: |
grep '"result": true' dm_setup_task.log
- name: Check status
run: |
./bin/dmctl operate-source show
./bin/dmctl query-status
./bin/dmctl query-status mariadb-to-tidb
- name: Run input
run: mysql -h 127.0.0.1 -u root -v < dm/tests/integration_basic/setup.sql
- name: Check status
run: |
./bin/dmctl operate-source show
./bin/dmctl query-status
./bin/dmctl query-status mariadb-to-tidb
- name: install mysql-tester
run: |
go install github.com/pingcap/mysql-tester/src@f2d90ea9522d30c9a8e8d70cc31c7f016ca2801f
mv ~/go/bin/src ~/go/bin/mysql-tester
# - name: record validation test
# working-directory: ./dm/tests/integration_basic
# run: ~/go/bin/mysql-tester -record basic
# - name: show results
# working-directory: ./dm/tests/integration_basic
# run: cat r/basic.result
- name: debug
run: |
sleep 30
mysql -h 127.0.0.1 -u root -e "DESCRIBE test_basic.t1"
mysql -h 127.0.0.1 -u root -e "SELECT * FROM test_basic.t1"
mysql -h 127.0.0.1 -u root -P 4000 -e "DESCRIBE test_basic.t1"
mysql -h 127.0.0.1 -u root -P 4000 -e "SELECT * FROM test_basic.t1"
mysql -h 127.0.0.1 -u root -e "SHOW BINARY LOGS"
mysql -h 127.0.0.1 -u root -e "SHOW BINLOG EVENTS"
- name: check logs
continue-on-error: true
run: |
jq 'select(.level == "DPANIC") | .message + ": " + .error' dm_worker.log
jq 'select(.level == "ERROR") | .message + ": " + .error' dm_worker.log
- name: run validation tests
working-directory: ./dm/tests/integration_basic
run: |
~/go/bin/mysql-tester
- name: Check status
if: ${{ always() }}
run: |
./bin/dmctl operate-source show
./bin/dmctl query-status
./bin/dmctl query-status mariadb-to-tidb | tee dm_task_status.log
- name: upload artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v7
with:
name: dm-logs-mariadb-${{ matrix.mariadb_version }}
path: dm*log