-
Notifications
You must be signed in to change notification settings - Fork 433
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
813cd5e
commit f4d7c20
Showing
31 changed files
with
625 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
# prepare env | ||
if [ $(ls $HOME/go/bin/|grep ginkgo|wc -l) -eq 0 ];then | ||
go install github.com/onsi/ginkgo/v2/[email protected] | ||
fi | ||
|
||
# prepare etcd env | ||
# shellcheck disable=SC2069 | ||
|
||
function check_pid() { | ||
value=$1 | ||
pid_num=$(ps aux|grep "$value"|grep -v 'grep'|wc -l) | ||
echo $pid_num | ||
} | ||
|
||
function check_mysql_dir() { | ||
value=$1 | ||
pid_num=$(ps aux|grep etcd|grep -v 'grep'|wc -l) | ||
dir_num=$(ls /data/mysql/|grep "$value"|wc -l) | ||
echo $dir_num | ||
} | ||
|
||
if [ $(check_pid "etcd") -eq 0 ];then | ||
etcd --data-dir bin/etcd 2>&1 &>>bin/etcd.log & | ||
fi | ||
|
||
# Start 2 Mysql Cluster | ||
# Cluster-1: 3319(master), 3329(slave), 3339(slave) | ||
# Prepare Cluster-1 for master | ||
if [ $(check_mysql_dir "3319") -eq 0 ];then | ||
cp ./tests/docker/mysql8/my3319.cnf /data/etc/my3319.cnf | ||
mysqld --defaults-file=/data/etc/my3319.cnf --user=work --initialize-insecure | ||
mysqld --defaults-file=/data/etc/my3319.cnf --user=work & | ||
sleep 3 | ||
mysql -h127.0.0.1 -P3319 -uroot -S/data/tmp/mysql3319.sock <<EOF | ||
reset master; | ||
CREATE USER 'mysqlsync'@'%' IDENTIFIED with mysql_native_password BY 'mysqlsync'; | ||
GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'mysqlsync'@'%'; | ||
CREATE USER 'superroot'@'%' IDENTIFIED with mysql_native_password BY 'superroot'; | ||
GRANT ALL PRIVILEGES ON *.* TO 'superroot'@'%' WITH GRANT OPTION; | ||
CREATE USER 'gaea_backend_user'@'%' IDENTIFIED with mysql_native_password BY 'gaea_backend_pass'; | ||
GRANT SELECT, INSERT, UPDATE, DELETE ON *.* TO 'gaea_backend_user'@'%'; | ||
GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'gaea_backend_user'@'%'; | ||
EOF | ||
else | ||
if [ $(check_pid "my3319") -eq 0 ];then | ||
mysqld --defaults-file=/data/etc/my3319.cnf --user=work & | ||
fi | ||
fi | ||
|
||
# Prepare Cluster-1 slave 1 | ||
if [ $(check_mysql_dir "3329") -eq 0 ];then | ||
cp ./tests/docker/mysql8/my3329.cnf /data/etc/my3329.cnf | ||
mysqld --defaults-file=/data/etc/my3329.cnf --user=work --initialize-insecure | ||
mysqld --defaults-file=/data/etc/my3329.cnf --user=work & | ||
sleep 3 | ||
mysql -h127.0.0.1 -P3329 -uroot -S/data/tmp/mysql3329.sock <<EOF | ||
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=3319, MASTER_USER='mysqlsync', MASTER_PASSWORD='mysqlsync', MASTER_AUTO_POSITION=1; | ||
START SLAVE; | ||
DO SLEEP(1); | ||
EOF | ||
else | ||
if [ $(check_pid "my3329") -eq 0 ];then | ||
mysqld --defaults-file=/data/etc/my3329.cnf --user=work & | ||
fi | ||
fi | ||
|
||
# Prepare Cluster-1 slave 2 | ||
if [ $(check_mysql_dir "3339") -eq 0 ];then | ||
cp ./tests/docker/mysql8/my3339.cnf /data/etc/my3339.cnf | ||
mysqld --defaults-file=/data/etc/my3339.cnf --user=work --initialize-insecure | ||
mysqld --defaults-file=/data/etc/my3339.cnf --user=work & | ||
sleep 3 | ||
mysql -h127.0.0.1 -P3339 -uroot -S/data/tmp/mysql3339.sock <<EOF | ||
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=3319, MASTER_USER='mysqlsync', MASTER_PASSWORD='mysqlsync', MASTER_AUTO_POSITION=1; | ||
START SLAVE; | ||
DO SLEEP(1); | ||
EOF | ||
else | ||
if [ $(check_pid "my3339") -eq 0 ];then | ||
mysqld --defaults-file=/data/etc/my3339.cnf --user=work & | ||
fi | ||
fi | ||
|
||
# Cluster-2: 3379(master) | ||
if [ $(check_mysql_dir "3379") -eq 0 ];then | ||
cp ./tests/docker/mysql8/my3379.cnf /data/etc/my3379.cnf | ||
mysqld --defaults-file=/data/etc/my3379.cnf --user=work --initialize-insecure | ||
mysqld --defaults-file=/data/etc/my3379.cnf --user=work & | ||
sleep 3 | ||
mysql -h127.0.0.1 -P3379 -uroot -S/data/tmp/mysql3379.sock <<EOF | ||
reset master; | ||
CREATE USER 'mysqlsync'@'%' IDENTIFIED with mysql_native_password BY 'mysqlsync'; | ||
GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'mysqlsync'@'%'; | ||
CREATE USER 'superroot'@'%' IDENTIFIED with mysql_native_password BY 'superroot'; | ||
GRANT ALL PRIVILEGES ON *.* TO 'superroot'@'%' WITH GRANT OPTION; | ||
CREATE USER 'gaea_backend_user'@'%' IDENTIFIED with mysql_native_password BY 'gaea_backend_pass'; | ||
GRANT SELECT, INSERT, UPDATE, DELETE ON *.* TO 'gaea_backend_user'@'%'; | ||
GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'gaea_backend_user'@'%'; | ||
EOF | ||
else | ||
if [ $(check_pid "my3379") -eq 0 ];then | ||
mysqld --defaults-file=/data/etc/my3379.cnf --user=work & | ||
fi | ||
fi | ||
|
||
# Cluster-3: 3349(master) | ||
if [ $(check_mysql_dir "3349") -eq 0 ];then | ||
cp ./tests/docker/mysql8/my3349.cnf /data/etc/my3349.cnf | ||
mysqld --defaults-file=/data/etc/my3349.cnf --user=work --initialize-insecure | ||
mysqld --defaults-file=/data/etc/my3349.cnf --user=work & | ||
sleep 3 | ||
mysql -h127.0.0.1 -P3349 -uroot -S/data/tmp/mysql3349.sock <<EOF | ||
reset master; | ||
CREATE USER 'mysqlsync'@'%' IDENTIFIED with mysql_native_password BY 'mysqlsync'; | ||
GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'mysqlsync'@'%'; | ||
CREATE USER 'superroot'@'%' IDENTIFIED with mysql_native_password BY 'superroot'; | ||
GRANT ALL PRIVILEGES ON *.* TO 'superroot'@'%' WITH GRANT OPTION; | ||
CREATE USER 'gaea_backend_user'@'%' IDENTIFIED with mysql_native_password BY 'gaea_backend_pass'; | ||
GRANT SELECT, INSERT, UPDATE, DELETE ON *.* TO 'gaea_backend_user'@'%'; | ||
GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'gaea_backend_user'@'%'; | ||
EOF | ||
else | ||
if [ $(check_pid "my3349") -eq 0 ];then | ||
mysqld --defaults-file=/data/etc/my3349.cnf --user=work & | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
ginkgo --v --progress --trace --flake-attempts=1 --skip "^.*only mysql8:.*$" ./tests/e2e/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
ginkgo --v --progress --trace --flake-attempts=1 --skip '^.*only mysql5:.*$' --skip '^.*shard join support test in.*$' --skip 'test dml set variables' --skip 'simple sql test' --skip='Unshard DML Support Test' ./tests/e2e/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
# 更新源 | ||
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* | ||
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* | ||
|
||
# install mysql | ||
yum install -y wget perl net-tools etcd curl libaio libaio-devel numactl make git gcc | ||
yum install -y glibc | ||
yum update -y | ||
# modify timezone | ||
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime | ||
|
||
cd /dist | ||
wget https://downloads.percona.com/downloads/Percona-Server-5.7/Percona-Server-5.7.25-28/binary/redhat/7/x86_64/Percona-Server-server-57-5.7.25-28.1.el7.x86_64.rpm | ||
wget https://downloads.percona.com/downloads/Percona-Server-5.7/Percona-Server-5.7.25-28/binary/redhat/7/x86_64/Percona-Server-shared-compat-57-5.7.25-28.1.el7.x86_64.rpm | ||
wget https://downloads.percona.com/downloads/Percona-Server-5.7/Percona-Server-5.7.25-28/binary/redhat/7/x86_64/Percona-Server-shared-57-5.7.25-28.1.el7.x86_64.rpm | ||
wget https://downloads.percona.com/downloads/Percona-Server-5.7/Percona-Server-5.7.25-28/binary/redhat/7/x86_64/Percona-Server-client-57-5.7.25-28.1.el7.x86_64.rpm | ||
|
||
rpm -ivh Percona-Server-server-57-5.7.25-28.1.el7.x86_64.rpm \ | ||
Percona-Server-shared-compat-57-5.7.25-28.1.el7.x86_64.rpm \ | ||
Percona-Server-shared-57-5.7.25-28.1.el7.x86_64.rpm \ | ||
Percona-Server-client-57-5.7.25-28.1.el7.x86_64.rpm | ||
|
||
rm -rf Percona-Server-server-57-5.7.25-28.1.el7.x86_64.rpm \ | ||
Percona-Server-shared-compat-57-5.7.25-28.1.el7.x86_64.rpm \ | ||
Percona-Server-shared-57-5.7.25-28.1.el7.x86_64.rpm \ | ||
Percona-Server-client-57-5.7.25-28.1.el7.x86_64.rpm | ||
|
||
groupadd -r --gid 2000 work | ||
useradd -r -g work --uid 1000 work | ||
mkdir -p /data/mysql /data/tmp /data/etc | ||
chown -R work:work /data | ||
|
||
# install golang | ||
wget https://go.dev/dl/go1.16.15.linux-amd64.tar.gz | ||
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.16.15.linux-amd64.tar.gz | ||
|
||
# 提前安装一些依赖库,跑 CI 的时间就可以不用拉了,减少测试用例时间 | ||
/usr/local/go/bin/go install github.com/onsi/ginkgo/v2/[email protected] | ||
/usr/local/go/bin/go mod download github.com/shirou/[email protected]+incompatible | ||
/usr/local/go/bin/go mod download go.uber.org/[email protected] | ||
/usr/local/go/bin/go mod download github.com/golang/[email protected] | ||
/usr/local/go/bin/go mod download github.com/gin-contrib/[email protected] | ||
/usr/local/go/bin/go mod download github.com/gin-gonic/[email protected] | ||
/usr/local/go/bin/go mod download github.com/pingcap/[email protected] | ||
/usr/local/go/bin/go mod download github.com/shopspring/[email protected] | ||
/usr/local/go/bin/go mod download github.com/hashicorp/[email protected] | ||
/usr/local/go/bin/go mod download github.com/go-ini/[email protected] | ||
/usr/local/go/bin/go mod download github.com/pingcap/[email protected] | ||
/usr/local/go/bin/go mod download github.com/coreos/[email protected]+incompatible | ||
/usr/local/go/bin/go mod download github.com/emirpasic/[email protected] | ||
/usr/local/go/bin/go mod download github.com/prometheus/[email protected] | ||
/usr/local/go/bin/go mod download github.com/cznic/[email protected] | ||
/usr/local/go/bin/go mod download github.com/prometheus/[email protected] | ||
/usr/local/go/bin/go mod download github.com/prometheus/[email protected] | ||
/usr/local/go/bin/go mod download github.com/beorn7/[email protected] | ||
/usr/local/go/bin/go mod download github.com/golang/[email protected] | ||
/usr/local/go/bin/go mod download github.com/prometheus/[email protected] | ||
/usr/local/go/bin/go mod download github.com/remyoudompheng/[email protected] | ||
/usr/local/go/bin/go mod download github.com/mattn/[email protected] | ||
/usr/local/go/bin/go mod download github.com/gin-contrib/[email protected] | ||
/usr/local/go/bin/go mod download gopkg.in/[email protected] | ||
/usr/local/go/bin/go mod download github.com/ugorji/[email protected] | ||
/usr/local/go/bin/go mod download github.com/go-playground/validator/[email protected] | ||
/usr/local/go/bin/go mod download golang.org/x/[email protected] | ||
/usr/local/go/bin/go mod download github.com/ugorji/go/[email protected] | ||
/usr/local/go/bin/go mod download google.golang.org/[email protected] | ||
/usr/local/go/bin/go mod download github.com/matttproud/[email protected] | ||
/usr/local/go/bin/go mod download golang.org/x/[email protected] | ||
/usr/local/go/bin/go mod download golang.org/x/[email protected] | ||
/usr/local/go/bin/go mod download github.com/leodido/[email protected] | ||
/usr/local/go/bin/go mod download github.com/go-playground/[email protected] | ||
/usr/local/go/bin/go mod download github.com/go-playground/[email protected] | ||
/usr/local/go/bin/go mod download github.com/modern-go/[email protected] | ||
/usr/local/go/bin/go mod download github.com/json-iterator/[email protected] | ||
/usr/local/go/bin/go mod download github.com/coreos/[email protected] | ||
/usr/local/go/bin/go mod download google.golang.org/[email protected] | ||
/usr/local/go/bin/go mod download github.com/gogo/[email protected] | ||
/usr/local/go/bin/go mod download golang.org/x/[email protected] | ||
/usr/local/go/bin/go mod download github.com/modern-go/[email protected] | ||
/usr/local/go/bin/go mod download google.golang.org/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.