-
Notifications
You must be signed in to change notification settings - Fork 12
138 lines (120 loc) · 4.04 KB
/
cluster_endtoend_mtr_docker.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
name: "MTR Test - Ubuntu Docker Cluster"
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- main
- 'release-*'
tags:
- '*'
workflow_dispatch:
env:
IMAGE_NAME: wescale_ci_image
REGISTRY: ghcr.io
IMAGE_TAG: test-${{ github.sha }}
MYSQL_VERSION: 8.0.32
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-mtr
cancel-in-progress: true
jobs:
build-image:
permissions:
contents: read
packages: write
uses: ./.github/workflows/build_image.yml
with:
branch: ${{ github.ref }}
image_name: ${{ github.repository_owner }}/wescale_ci_image
tags: test-${{ github.sha }}
platforms: linux/amd64
want_push: false
want_load: true
want_artifact: true
artifact_name: 'image.tar'
setup:
name: "MTR Test - Ubuntu Docker Cluster"
needs: build-image
runs-on: ubuntu-latest
steps:
- 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: Checkout code
if: steps.skip-workflow.outputs.skip-workflow == 'false'
uses: actions/checkout@v3
- name: Login to registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Download Docker image
uses: actions/download-artifact@v3
with:
name: image.tar
path: /tmp
- name: Load Docker image
run: |
docker load < /tmp/image.tar
echo "Verifying image loaded:"
docker images
- name: Set up cluster
run: |
MYSQL_IMG="mysql/mysql-server:${{ env.MYSQL_VERSION }}"
WESCALE_CI_IMAGE="${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}"
docker network create wescale-network
docker run -itd --network wescale-network --name mysql-server \
-p 3306:3306 \
-e MYSQL_ROOT_PASSWORD=passwd \
-e MYSQL_ROOT_HOST=% \
-e MYSQL_LOG_CONSOLE=true \
$MYSQL_IMG \
--bind-address=0.0.0.0 \
--port=3306 \
--log-bin=binlog \
--gtid_mode=ON \
--enforce_gtid_consistency=ON \
--log_replica_updates=ON \
--binlog_format=ROW
docker run -itd --network wescale-network --name wescale \
-p 15306:15306 \
-w /vt/examples/wesql-server \
-e MYSQL_ROOT_USER=root \
-e MYSQL_ROOT_PASSWORD=passwd \
-e MYSQL_PORT=3306 \
-e MYSQL_HOST=mysql-server \
$WESCALE_CI_IMAGE \
/vt/examples/wesql-server/init_single_node_cluster.sh
- name: Checkout mysql-tester code
if: steps.skip-workflow.outputs.skip-workflow == 'false'
uses: actions/checkout@v3
with:
repository: apecloud/mysql-tester
path: './mysql-tester'
- name: Build mysql-tester
if: steps.skip-workflow.outputs.skip-workflow == 'false'
run: |
cd ./mysql-tester && \
mkdir bin && \
make build
- name: Run MTR Tests
if: steps.skip-workflow.outputs.skip-workflow == 'false'
run: |
cd ./mysql-tester && \
eatmydata -- ./bin/mysql-tester -user root -port 15306 -path testcase/wesql-scale 2>&1 | tee -a output.txt
if grep -q -- 'level=error' output.txt; then
echo "Testcase is failed"
exit 1
else
echo "Testcase is successful"
fi
- name: Print Wescale logs
run: |
docker logs wescale