Skip to content

Commit 3099620

Browse files
author
Wagner Franchin
committed
Added Travis CI scripts
1 parent bb206df commit 3099620

File tree

3 files changed

+51
-0
lines changed

3 files changed

+51
-0
lines changed

.travis.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
language: bash
2+
services:
3+
- docker
4+
script:
5+
- docker-compose up -d
6+
- docker-compose ps
7+
- sleep 120
8+
- docker-compose ps
9+
- docker logs node1
10+
- bash ./travis-ci/create_gr.sh
11+
- bash ./travis-ci/test_gr.sh
12+
after_script:
13+
- docker-compose down
14+

travis-ci/create_gr.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
docker-compose exec node1 mysql -uroot -pmypass \
4+
-e "SET @@GLOBAL.group_replication_bootstrap_group=1;" \
5+
-e "create user 'repl'@'%';" \
6+
-e "GRANT REPLICATION SLAVE ON *.* TO repl@'%';" \
7+
-e "flush privileges;" \
8+
-e "change master to master_user='root' for channel 'group_replication_recovery';" \
9+
-e "START GROUP_REPLICATION;" \
10+
-e "SET @@GLOBAL.group_replication_bootstrap_group=0;" \
11+
-e "SELECT * FROM performance_schema.replication_group_members;"
12+
13+
for N in 2 3
14+
do docker-compose exec node$N mysql -uroot -pmypass \
15+
-e "change master to master_user='repl' for channel 'group_replication_recovery';" \
16+
-e "START GROUP_REPLICATION;"
17+
done

travis-ci/test_gr.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
RESULT_FILE="test.txt"
4+
5+
docker-compose exec node1 mysql -uroot -pmypass \
6+
-e "SHOW VARIABLES WHERE Variable_name = 'hostname';" \
7+
-e "SELECT * FROM performance_schema.replication_group_members;" > $RESULT_FILE
8+
9+
CODE=$(egrep -c 'ONLINE' $RESULT_FILE)
10+
11+
cat $RESULT_FILE
12+
rm $RESULT_FILE
13+
14+
if [[ $CODE == 3 ]]; then
15+
echo "Test check passed, 3 nodes ONLINE"
16+
exit 0
17+
else
18+
echo "Test check failed"
19+
exit 1
20+
fi

0 commit comments

Comments
 (0)