polardbxengine/mysql-test/suite/xengine_rpl_basic/t/rpl_ssl.test

158 lines
4.5 KiB
Plaintext

--source include/not_group_replication_plugin.inc
source include/master-slave.inc;
# Default replication setup at master-slave.inc does not set MASTER_SSL
--connection slave
--let $current_master_ssl= query_get_value(SHOW SLAVE STATUS, Master_SSL_Allowed, 1)
--let $assert_text= Master_SSL_Allowed should be NO by default
--let $assert_cond= "$current_master_ssl" = "NO"
--source include/assert.inc
# The slave should be initially connected to the master without SSL/TLS
--connection master
--let $field= Command
--let $condition= = 'Binlog Dump'
--let $show_statement= SHOW PROCESSLIST
--source include/wait_show_condition.inc
--let $connection_type= `SELECT CONNECTION_TYPE FROM performance_schema.threads WHERE PROCESSLIST_COMMAND LIKE "Binlog Dump%"`
--let $assert_text= Without MASTER_SSL, the slave should be connected to the master without SSL/TLS
--let $assert_cond= "$connection_type" <> "SSL/TLS" AND "$connection_type" <> ""
--source include/assert.inc
# create a user for replication that requires ssl encryption
connection master;
create user replssl@localhost require ssl;
grant replication slave on *.* to replssl@localhost;
create table t1 (t int auto_increment, KEY(t));
--source include/sync_slave_sql_with_master.inc
# Set slave to use SSL for connection to master
stop slave;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--replace_column 2 ####
eval change master to
master_user='replssl',
master_password='',
master_ssl=1,
master_ssl_ca ='$MYSQL_TEST_DIR/std_data/cacert.pem',
master_ssl_cert='$MYSQL_TEST_DIR/std_data/client-cert.pem',
master_ssl_key='$MYSQL_TEST_DIR/std_data/client-key.pem';
start slave;
# Switch to master and insert one record, then sync it to slave
connection master;
insert into t1 values(1);
--source include/sync_slave_sql_with_master.inc
# The record should now be on slave
select * from t1;
# The slave is synced and waiting/reading from master
# SHOW SLAVE STATUS will show "Waiting for master to send event"
let $status_items= Master_SSL_Allowed, Master_SSL_CA_Path, Master_SSL_CA_File, Master_SSL_Cert, Master_SSL_Key;
source include/show_slave_status.inc;
source include/check_slave_is_running.inc;
# Stop the slave, as reported in bug#21871 it would hang
STOP SLAVE;
select * from t1;
# Do the same thing a number of times
disable_query_log;
disable_result_log;
# 2007-11-27 mats Bug #32756 Starting and stopping the slave in a loop can lose rows
# After discussions with Engineering, I'm disabling this part of the test to avoid it causing
# red trees.
disable_testcase BUG#32756;
let $i= 100;
while ($i)
{
start slave;
connection master;
insert into t1 values (NULL);
select * from t1; # Some variance
connection slave;
select * from t1; # Some variance
stop slave;
dec $i;
}
enable_testcase;
START SLAVE;
enable_query_log;
enable_result_log;
connection master;
# INSERT one more record to make sure
# the sync has something to do
insert into t1 values (NULL);
let $master_count= `select count(*) from t1`;
--source include/sync_slave_sql_with_master.inc
--source include/wait_for_slave_to_start.inc
source include/show_slave_status.inc;
source include/check_slave_is_running.inc;
let $slave_count= `select count(*) from t1`;
if ($slave_count != $master_count)
{
echo master and slave differed in number of rows;
echo master: $master_count;
echo slave: $slave_count;
connection master;
echo === master ===;
select count(*) t1;
select * from t1;
connection slave;
echo === slave ===;
select count(*) t1;
select * from t1;
query_vertical show slave status;
}
connection master;
drop user replssl@localhost;
drop table t1;
--source include/sync_slave_sql_with_master.inc
# ==== BUG#18165937: HITTING CRASH WHEN SETTING SSL OPTIONS THROUGH CHANGE MASTER COMMAND ====
--source include/stop_slave.inc
--replace_column 2 ####
CHANGE MASTER TO
master_user = 'root',
master_ssl = 0,
master_ssl_ca = '',
master_ssl_cert = '',
master_ssl_key = '',
master_ssl_crl='',
master_ssl_crlpath='';
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
eval CHANGE MASTER TO MASTER_SSL= 1, MASTER_SSL_CRL='$MYSQL_TEST_DIR/std_data/crl-client-revoked.crl', MASTER_SSL_CRLPATH='$MYSQL_TEST_DIR/std_data/crldir';
--source include/start_slave.inc
--source include/stop_slave.inc
--replace_column 2 ####
CHANGE MASTER TO
master_user = 'root',
master_ssl = 0,
master_ssl_ca = '',
master_ssl_cert = '',
master_ssl_key = '',
master_ssl_crl='',
master_ssl_crlpath='';
--echo End of 5.0 tests
--let $rpl_only_running_threads= 1
--source include/rpl_end.inc
--connection master
--source suite/xengine/include/check_xengine_log_error.inc