MXS-1476: Add test case
Test for MXS-1476 that checks that the behavior is what is expected. Currently, the test passes as behavior is what is expected.
This commit is contained in:
parent
bc36dd3e1a
commit
41f6400852
@ -506,6 +506,10 @@ add_test_executable(mxs1457_ignore_deleted.cpp mxs1457_ignore_deleted mxs1457_ig
|
||||
# https://jira.mariadb.org/browse/MXS-1468
|
||||
add_test_executable(mxs1468.cpp mxs1468 mxs1468 LABELS REPL_BACKEND)
|
||||
|
||||
# MXS-1476: priority value ignored when a Galera node rejoins with a lower wsrep_local_index than current master
|
||||
# https://jira.mariadb.org/browse/MXS-1476
|
||||
add_test_executable(mxs1476.cpp mxs1476 mxs1476 LABELS GALERA_BACKEND)
|
||||
|
||||
# 'namedserverfilter' test
|
||||
add_test_executable(namedserverfilter.cpp namedserverfilter namedserverfilter LABELS namedserverfilter LIGHT REPL_BACKEND)
|
||||
|
||||
|
52
maxscale-system-test/cnf/maxscale.cnf.template.mxs1476
Normal file
52
maxscale-system-test/cnf/maxscale.cnf.template.mxs1476
Normal file
@ -0,0 +1,52 @@
|
||||
[maxscale]
|
||||
threads=###threads###
|
||||
retry_queries=1
|
||||
|
||||
[Galera Monitor]
|
||||
type=monitor
|
||||
module=galeramon
|
||||
servers=server1,server2
|
||||
user=maxskysql
|
||||
passwd=skysql
|
||||
monitor_interval=1000
|
||||
root_node_as_master=false
|
||||
use_priority=true
|
||||
backend_connect_timeout=1
|
||||
backend_read_timeout=1
|
||||
|
||||
[RW Split Router]
|
||||
type=service
|
||||
router=readwritesplit
|
||||
servers=server1,server2
|
||||
user=maxskysql
|
||||
passwd=skysql
|
||||
|
||||
[RW Split Listener]
|
||||
type=listener
|
||||
service=RW Split Router
|
||||
protocol=MySQLClient
|
||||
port=4006
|
||||
|
||||
[CLI]
|
||||
type=service
|
||||
router=cli
|
||||
|
||||
[CLI Listener]
|
||||
type=listener
|
||||
service=CLI
|
||||
protocol=maxscaled
|
||||
socket=default
|
||||
|
||||
[server1]
|
||||
type=server
|
||||
address=###galera_server_IP_1###
|
||||
port=###galera_server_port_1###
|
||||
protocol=MySQLBackend
|
||||
priority=2
|
||||
|
||||
[server2]
|
||||
type=server
|
||||
address=###galera_server_IP_2###
|
||||
port=###galera_server_port_2###
|
||||
protocol=MySQLBackend
|
||||
priority=1
|
63
maxscale-system-test/mxs1476.cpp
Normal file
63
maxscale-system-test/mxs1476.cpp
Normal file
@ -0,0 +1,63 @@
|
||||
/**
|
||||
* MXS-1476: priority value ignored when a Galera node rejoins with a lower wsrep_local_index than current master
|
||||
*
|
||||
* https://jira.mariadb.org/browse/MXS-1476
|
||||
*/
|
||||
|
||||
#include "testconnections.h"
|
||||
|
||||
void do_test(TestConnections& test, int master, int slave)
|
||||
{
|
||||
test.connect_maxscale();
|
||||
test.try_query(test.conn_rwsplit, "DROP TABLE IF EXISTS test.t1");
|
||||
test.try_query(test.conn_rwsplit, "CREATE TABLE test.t1 (id int)");
|
||||
test.try_query(test.conn_rwsplit, "INSERT INTO test.t1 VALUES (1)");
|
||||
|
||||
test.tprintf("Block a slave node and perform an insert");
|
||||
test.galera->block_node(slave);
|
||||
sleep(5);
|
||||
test.try_query(test.conn_rwsplit, "INSERT INTO test.t1 VALUES (1)");
|
||||
|
||||
test.tprintf("Unblock the slave node and perform another insert");
|
||||
test.galera->unblock_node(slave);
|
||||
sleep(5);
|
||||
test.try_query(test.conn_rwsplit, "INSERT INTO test.t1 VALUES (1)");
|
||||
test.close_maxscale_connections();
|
||||
|
||||
test.tprintf("Block the master node and perform an insert");
|
||||
test.galera->block_node(master);
|
||||
sleep(5);
|
||||
test.connect_maxscale();
|
||||
test.try_query(test.conn_rwsplit, "INSERT INTO test.t1 VALUES (1)");
|
||||
|
||||
test.tprintf("Unblock the master node and perform another insert (expecting failure)");
|
||||
test.galera->unblock_node(master);
|
||||
sleep(5);
|
||||
test.add_result(execute_query_silent(test.conn_rwsplit, "INSERT INTO test.t1 VALUES (1)") == 0, "Query should fail");
|
||||
test.close_maxscale_connections();
|
||||
|
||||
test.connect_maxscale();
|
||||
test.try_query(test.conn_rwsplit, "DROP TABLE test.t1");
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
TestConnections test(argc, argv);
|
||||
test.galera->stop_node(2);
|
||||
test.galera->stop_node(3);
|
||||
|
||||
do_test(test, 1, 0);
|
||||
|
||||
test.tprintf("Swap the priorities around and run the test again");
|
||||
test.ssh_maxscale(true, "sed -i 's/priority=1/priority=3/' /etc/maxscale.cnf;"
|
||||
"sed -i 's/priority=2/priority=1/' /etc/maxscale.cnf;"
|
||||
"sed -i 's/priority=3/priority=2/' /etc/maxscale.cnf;");
|
||||
test.restart_maxscale();
|
||||
|
||||
do_test(test, 0, 1);
|
||||
|
||||
test.galera->start_node(2, "");
|
||||
test.galera->start_node(3, "");
|
||||
test.galera->fix_replication();
|
||||
return test.global_result;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user