Skip to content

Feature/role listener #616

Feature/role listener

Feature/role listener #616

# 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