tests: Can't setup replication slave without replication user

This commit is contained in:
Sameer Naik 2015-09-10 20:30:01 +05:30
parent e996d40828
commit 2ada7f8d48
2 changed files with 31 additions and 0 deletions

View File

@ -83,6 +83,12 @@ configure_replication() {
exit -1
fi
if [ ! $REPLICATION_USER ]; then
echo "In order to setup a replication slave you need to provide the REPLICATION_USER as well"
echo ""
exit -1
fi
echo "==> Setting the master configuration..."
echo "CHANGE MASTER TO MASTER_HOST='$MASTER_HOST', MASTER_USER='$REPLICATION_USER', MASTER_PASSWORD='$REPLICATION_PASSWORD';" >> /tmp/init_mysql.sql

View File

@ -233,6 +233,31 @@ create_full_container_mounted(){
cleanup_running_containers $CONTAINER_NAME-slave
}
@test "Can't setup replication slave without replication user" {
create_container -d --name $CONTAINER_NAME-master \
-e MARIADB_USER=$MARIADB_USER \
-e MARIADB_PASSWORD=$MARIADB_PASSWORD \
-e MARIADB_DATABASE=$MARIADB_DATABASE \
-e REPLICATION_MODE=master \
-e REPLICATION_USER=$REPLICATION_USER \
-e REPLICATION_PASSWORD=$REPLICATION_PASSWORD
run create_container --name $CONTAINER_NAME-slave \
--link $CONTAINER_NAME-master:master \
-e MASTER_HOST=$CONTAINER_NAME-master \
-e MASTER_USER=$MARIADB_USER \
-e MASTER_PASSWORD=$MARIADB_PASSWORD \
-e MARIADB_USER=$MARIADB_USER \
-e MARIADB_PASSWORD=$MARIADB_PASSWORD \
-e MARIADB_DATABASE=$MARIADB_DATABASE \
-e REPLICATION_MODE=slave
[[ "$output" =~ "you need to provide the REPLICATION_USER" ]]
cleanup_running_containers $CONTAINER_NAME-master
cleanup_running_containers $CONTAINER_NAME-slave
}
@test "Replication slave can automatically fetch connection parameters from master using docker links" {
create_container -d --name $CONTAINER_NAME-master \
-e MARIADB_USER=$MARIADB_USER \