-
Notifications
You must be signed in to change notification settings - Fork 6
342 lines (302 loc) · 13.4 KB
/
e2e-compose.yaml
File metadata and controls
342 lines (302 loc) · 13.4 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
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
name: MatrixOne Compose Test
on:
workflow_call:
secrets:
TOKEN_ACTION:
description: "Token for checkout (e.g. pull from fork/private)"
required: false
jobs:
bvt-docker-compose-push:
if: ${{ !github.event.pull_request.draft }}
environment: ci
runs-on: ${{ vars.RUNNER_LABEL || 'ubuntu-22.04' }}
name: multi cn e2e bvt test docker compose(Optimistic/PUSH)
timeout-minutes: 60
steps:
- name: Pre Clean Some Unneeded Images
run: |
sudo df -h /*
echo "========================================="
sudo docker builder prune -f -a;
sudo docker images | grep -v REPOSITORY | awk '{system("sudo docker rmi "$1":"$2)}';
sudo docker volume prune -f;
echo "========================================="
sudo df -h /*
- name: checkout
uses: actions/checkout@v6
with:
token: ${{ secrets.TOKEN_ACTION }}
fetch-depth: "3"
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- name: Set up Go And Java
uses: matrixorigin/CI/actions/setup-env@main
with:
go-version-file: "${{ github.workspace }}/go.mod"
- name: Print run attempt
run: echo "run attempt is ${{ github.run_attempt }}"
- name: Print Disk Usage Before Container Start
if: ${{ always() }}
run: |
set +e;
sudo df -h /*;
echo "===========================================";
sudo du -hs /var/lib/docker;
echo "===========================================";
sudo docker system df -v;
- name: docker compose launch-multi-cn
timeout-minutes: 10
run: |
echo "" >> ./etc/launch-tae-compose/config/cn-0.toml
echo '[cn.txn]' >> ./etc/launch-tae-compose/config/cn-0.toml
echo 'mode = "Optimistic"' >> ./etc/launch-tae-compose/config/cn-0.toml
echo "" >> ./etc/launch-tae-compose/config/cn-1.toml
echo '[cn.txn]' >> ./etc/launch-tae-compose/config/cn-1.toml
echo 'mode = "Optimistic"' >> ./etc/launch-tae-compose/config/cn-1.toml
echo "" >> ./etc/launch-tae-compose/config/tn.toml
echo '[tn.txn]' >> ./etc/launch-tae-compose/config/tn.toml
echo 'mode = "Optimistic"' >> ./etc/launch-tae-compose/config/tn.toml
cat ./etc/launch-tae-compose/config/cn-0.toml
cat ./etc/launch-tae-compose/config/cn-1.toml
cat ./etc/launch-tae-compose/config/tn.toml
# Update compose.yaml to mount test directory to $GITHUB_WORKSPACE/test instead of /test
# Replace container mount point from /test to $GITHUB_WORKSPACE/test
# Handle various docker-compose volume formats: /test, /test:options, /test followed by space
sed -i 's|:/test\b|:'"$GITHUB_WORKSPACE"'/test|g' ./etc/launch-tae-compose/compose.yaml
# build matrixone docker image first
docker build -t matrixorigin/matrixone:latest . -f ./optools/images/Dockerfile
mkdir -p ${{ github.workspace }}/docker-compose-log
docker compose -f etc/launch-tae-compose/compose.yaml --profile launch-multi-cn up -d
# wait for ready
i=1
while [ $(mysql -h 127.0.0.1 -P 6001 -u dump -p111 --execute 'create database if not exists compose_test;use compose_test; create table if not exists compose_test_table(col1 int auto_increment primary key);show tables;' 2>&1 | tee /dev/stderr | grep 'compose_test_table' | wc -l) -lt 1 ]; do
echo "wait mo init finished...$i"
if [ $i -ge 300 ]; then
echo "wait for $i seconds, mo init not finish, so exit 1"
docker ps
exit 1;
fi
i=$(($i+1))
sleep 1
done
docker ps
- name: Print Disk Usage After Container Start
if: ${{ always() }}
run: |
set +e;
sudo df -h /*;
echo "===========================================";
sudo du -hs /var/lib/docker;
echo "===========================================";
sudo docker system df -v;
- name: Clean Docker Image Build Cache
if: ${{ always() }}
run: |
sudo docker builder prune -f -a;
echo "===========================================";
sudo docker system df -v;
- name: Clone test-tool repository
# Node.js 12 actions are deprecated.
# For more information see:
# - https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/.
# Please update the following actions to use Node.js 16: actions/checkout@v3
uses: actions/checkout@v6
with:
repository: matrixorigin/mo-tester
path: ./mo-tester
ref: main
- name: Update BVT SQL Timeout
run: |
cd $GITHUB_WORKSPACE/mo-tester
sed -i "s/socketTimeout:.*/socketTimeout: 300000/g" mo.yml
- name: Start BVT Test
id: bvt_on_pr_version
run: |
export LC_ALL="C.UTF-8"
locale
cd $GITHUB_WORKSPACE/mo-tester
sed -i 's/ port: [0-9]*/ port: 12345/g' mo.yml
cat mo.yml
echo "============================="
./run.sh -n -g -o -p $GITHUB_WORKSPACE/test/distributed/cases -e pessimistic_transaction 2>&1
- name: Print Docker Info Before Container Shutdown
if: ${{ always() }}
run: |
set +e;
sudo docker ps;
echo "===========================================";
sudo df -h /*;
echo "===========================================";
sudo du -hs /var/lib/docker;
echo "===========================================";
sudo docker system df -v;
- name: Print System Dmesg
if: ${{ always() }}
continue-on-error: true
run: |
sudo dmesg -T
- name: export log
if: ${{ failure() || cancelled()}}
run: |
mkdir -p ${{ github.workspace }}/mo-tester/report
mv ${{ github.workspace }}/mo-tester/report ${{ github.workspace }}/docker-compose-log
curl http://localhost:12345/debug/pprof/goroutine\?debug=2 -o ${{ github.workspace }}/docker-compose-log/cn-0-dump-stacks.log
curl http://localhost:22345/debug/pprof/goroutine\?debug=2 -o ${{ github.workspace }}/docker-compose-log/cn-1-dump-stacks.log
- name: Check Log Messages Count per second
if: ${{ always() && !cancelled() }}
run: |
./optools/check_log_count.sh 1000 60 # {count threshold} {metric collected interval}
- name: shutdown containers
if: ${{ always() }}
run: |
docker compose -f etc/launch-tae-compose/compose.yaml --profile launch-multi-cn down --remove-orphans
docker volume rm launch-tae-compose_minio_storage
- uses: actions/upload-artifact@v7
if: ${{ failure() || cancelled()}}
continue-on-error: true
with:
name: Compose-multi-cn-e2e-bvt-test-docker-log(Optimistic,PUSH)
path: |
${{ github.workspace }}/docker-compose-log
retention-days: 7
multi-CN-bvt-docker-compose-pessimistic:
if: ${{ !github.event.pull_request.draft }}
environment: ci
runs-on: ${{ vars.RUNNER_LABEL || 'ubuntu-22.04' }}
name: multi cn e2e bvt test docker compose(PESSIMISTIC)
timeout-minutes: 60
steps:
- name: Pre Clean Some Unneeded Images
run: |
sudo df -h /*
echo "========================================="
sudo docker builder prune -f -a;
sudo docker images | grep -v REPOSITORY | awk '{system("sudo docker rmi "$1":"$2)}';
sudo docker volume prune -f;
echo "========================================="
sudo df -h /*
- name: checkout
uses: actions/checkout@v6
with:
token: ${{ secrets.TOKEN_ACTION }}
fetch-depth: "3"
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- name: Set up Go And Java
uses: matrixorigin/CI/actions/setup-env@main
with:
go-version-file: "${{ github.workspace }}/go.mod"
- name: Print run attempt
run: echo "run attempt is ${{ github.run_attempt }}"
- name: Print Disk Usage Before Container Start
if: ${{ always() }}
run: |
set +e;
sudo df -h /*;
echo "===========================================";
sudo du -hs /var/lib/docker;
echo "===========================================";
sudo docker system df -v;
- name: docker compose launch-multi-cn
timeout-minutes: 10
run: |
cat ./etc/launch-tae-compose/config/cn-0.toml
cat ./etc/launch-tae-compose/config/cn-1.toml
cat ./etc/launch-tae-compose/config/tn.toml
# Update compose.yaml to mount test directory to $GITHUB_WORKSPACE/test instead of /test
# Replace container mount point from /test to $GITHUB_WORKSPACE/test
# Handle various docker-compose volume formats: /test, /test:options, /test followed by space
sed -i 's|:/test\b|:'"$GITHUB_WORKSPACE"'/test|g' ./etc/launch-tae-compose/compose.yaml
# build matrixone docker image first
docker build -t matrixorigin/matrixone:latest . -f ./optools/images/Dockerfile
mkdir -p ${{ github.workspace }}/docker-compose-log
docker compose -f etc/launch-tae-compose/compose.yaml --profile launch-multi-cn up -d
# wait for ready
i=1
while [ $(mysql -h 127.0.0.1 -P 6001 -u dump -p111 --execute 'create database if not exists compose_test;use compose_test; create table if not exists compose_test_table(col1 int auto_increment primary key);show tables;' 2>&1 | tee /dev/stderr | grep 'compose_test_table' | wc -l) -lt 1 ]; do
echo "wait mo init finished...$i"
if [ $i -ge 300 ]; then
echo "wait for $i seconds, mo init not finish, so exit 1"
docker ps
exit 1;
fi
i=$(($i+1))
sleep 1
done
docker ps
- name: Print Disk Usage After Container Start
if: ${{ always() }}
run: |
set +e;
sudo df -h /*;
echo "===========================================";
sudo du -hs /var/lib/docker;
echo "===========================================";
sudo docker system df -v;
- name: Clean Docker Image Build Cache
if: ${{ always() }}
run: |
sudo docker builder prune -f -a;
echo "===========================================";
sudo docker system df -v;
- name: Clone test-tool repository
uses: actions/checkout@v6
with:
repository: matrixorigin/mo-tester
path: ./mo-tester
ref: main
- name: Update BVT SQL Timeout
run: |
cd $GITHUB_WORKSPACE/mo-tester
sed -i "s/socketTimeout:.*/socketTimeout: 300000/g" mo.yml
- name: Start BVT Test
id: bvt_on_pr_version
run: |
export LC_ALL="C.UTF-8"
locale
cd $GITHUB_WORKSPACE/mo-tester
sed -i 's/ port: [0-9]*/ port: 12345/g' mo.yml
cat mo.yml
echo "============================="
./run.sh -n -g -o -p $GITHUB_WORKSPACE/test/distributed/cases -e optimistic 2>&1
- name: Print Docker Info Before Container Shutdown
if: ${{ always() }}
run: |
set +e;
sudo docker ps;
echo "===========================================";
sudo df -h /*;
echo "===========================================";
sudo du -hs /var/lib/docker;
echo "===========================================";
sudo docker system df -v;
- name: Print System Dmesg
if: ${{ always() }}
continue-on-error: true
run: |
sudo dmesg -T
- name: export log
if: ${{ failure() || cancelled()}}
run: |
mkdir -p ${{ github.workspace }}/mo-tester/report
mv ${{ github.workspace }}/mo-tester/report ${{ github.workspace }}/docker-compose-log
curl http://localhost:12345/debug/pprof/goroutine\?debug=2 -o ${{ github.workspace }}/docker-compose-log/cn-0-dump-stacks.log
curl http://localhost:22345/debug/pprof/goroutine\?debug=2 -o ${{ github.workspace }}/docker-compose-log/cn-1-dump-stacks.log
- name: Check Log Messages Count per second
if: ${{ always() && !cancelled() }}
run: |
./optools/check_log_count.sh 1000 60 # {count threshold} {metric collected interval}
- name: shutdown containers
if: ${{ always() }}
run: |
docker ps
docker compose -f etc/launch-tae-compose/compose.yaml --profile launch-multi-cn down --remove-orphans
docker volume rm launch-tae-compose_minio_storage
- uses: actions/upload-artifact@v7
if: ${{ failure() || cancelled()}}
continue-on-error: true
with:
name: Compose-multi-cn-e2e-bvt-test-docker-log(PESSIMISTIC)
path: |
${{ github.workspace }}/docker-compose-log
retention-days: 7