-
Notifications
You must be signed in to change notification settings - Fork 12
155 lines (133 loc) · 6.01 KB
/
cluster_endtoend_mysqltester.yml
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
# DO NOT MODIFY: THIS FILE IS GENERATED USING "make generate_ci_workflows"
name: MTR Test
on:
pull_request:
workflow_dispatch:
push:
branches:
- main
concurrency:
group: format('{0}-{1}', ${{ github.ref }}, 'mysql-tester')
cancel-in-progress: true
env:
GITHUB_PR_HEAD_SHA: "${{ github.event.pull_request.head.sha }}"
jobs:
build:
name: Run endtoend mysql-tester tests on Cluster
runs-on: ubuntu-22.04
steps:
- name: Skip CI
run: |
if [[ "${{contains( github.event.pull_request.labels.*.name, 'Skip CI')}}" == "true" ]]; then
echo "skipping CI due to the 'Skip CI' label"
exit 1
fi
- name: Check if workflow needs to be skipped
id: skip-workflow
run: |
skip='false'
if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then
skip='true'
fi
echo Skip ${skip}
echo "skip-workflow=${skip}" >> $GITHUB_OUTPUT
- name: Check out code
if: steps.skip-workflow.outputs.skip-workflow == 'false'
uses: actions/checkout@v3
- name: Check for changes in relevant files
if: steps.skip-workflow.outputs.skip-workflow == 'false'
uses: frouioui/paths-filter@main
id: changes
with:
token: ''
filters: |
end_to_end:
- 'go/**/*.go'
- 'test.go'
- 'Makefile'
- 'build.env'
- 'go.sum'
- 'go.mod'
- 'proto/*.proto'
- 'tools/**'
- 'config/**'
- 'bootstrap.sh'
- '.github/workflows/cluster_endtoend_mysqltester.yml'
- name: Set up Go
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
uses: actions/setup-go@v3
with:
go-version: 1.20.1
- name: Set up python
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
uses: actions/setup-python@v4
- name: Tune the OS
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
run: |
# Limit local port range to not use ports that overlap with server side
# ports that we listen on.
sudo sysctl -w net.ipv4.ip_local_port_range="22768 65535"
# Increase the asynchronous non-blocking I/O. More information at https://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_use_native_aio
echo "fs.aio-max-nr = 1048576" | sudo tee -a /etc/sysctl.conf
sudo sysctl -p /etc/sysctl.conf
- name: Compile source
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
timeout-minutes: 30
run: |
make failpoint-enable
make build
make failpoint-disable
- name: Build and Run container
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
timeout-minutes: 45
run: |
# build image
DOCKER_BUILDKIT=0 docker build docker/wesqlscale/local/ -t apecloud/mysql-tester
# failpoint
chmod 755 ./test/failpoint/failpoints.sh && source ./test/failpoint/failpoints.sh
echo "GO_FAILPOINTS=$GO_FAILPOINTS" >> $GITHUB_OUTPUT
# run container
PWD=$(pwd)
docker run -id -v $PWD:/vt/src/mount -v /tmp:/wesqlscale/vt/vtdataroot -p 15306:15306 -e GO_FAILPOINTS=$GO_FAILPOINTS --name wesqlscale-build apecloud/mysql-tester
- name: Setup Cluster
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
timeout-minutes: 45
run: |
# build WeScale and setup WeScale cluster
docker exec wesqlscale-build bash -c "cd examples/mysql && ./init_cluster.sh"
# enlarge mysql max_connections
docker exec wesqlscale-build bash -c "mysql -uroot -h127.0.0.1 -P17101 -e \"SET @@GLOBAL.max_connections = 1000;\""
docker exec wesqlscale-build bash -c "mysql -uroot -h127.0.0.1 -P17100 -e \"SET @@GLOBAL.max_connections = 1000;\""
docker exec wesqlscale-build bash -c "mysql -uroot -h127.0.0.1 -P17102 -e \"SET @@GLOBAL.max_connections = 1000;\""
- name: Checkout mysql-tester code
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
uses: actions/checkout@v2
with:
repository: apecloud/mysql-tester
path: './mysql-tester'
- name: Build mysql-tester
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
run: |
cd ./mysql-tester && \
mkdir bin && \
make build
- name: Run endtoend test
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
run: |
cd ./mysql-tester && \
eatmydata -- ./bin/mysql-tester -user root -port 15306 -path testcase/wesql-scale 2>&1 | tee -a output.txt
- name: Print test output
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' && always()
run: |
# print test output
cat ./mysql-tester/output.txt
- name: Check test results
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' && always()
run: |
# check if any test failed
if grep -q -- 'level=error' ./mysql-tester/output.txt; then
echo "Testcase is failed"
exit 1
else
echo "Testcase is successful"
fi