MXS-1295: Add test case
The test case checks that the strict_sp_calls parameter works as expected.
This commit is contained in:
@ -488,6 +488,12 @@ add_test_executable(mxs1319.cpp mxs1319 replication LABELS MySQLAuth REPL_BACKEN
|
||||
# https://jira.mariadb.org/browse/MXS-1418
|
||||
add_test_executable(mxs1418.cpp mxs1418 replication LABELS maxscale REPL_BACKEND)
|
||||
|
||||
# MXS-1295: MaxScale's readwritesplit router does not take into account the fact
|
||||
# that stored procedure call may change the value of a user variable
|
||||
#
|
||||
# https://jira.mariadb.org/browse/MXS-1295
|
||||
add_test_executable(mxs1295_sp_call.cpp mxs1295_sp_call mxs1295 LABELS maxscale REPL_BACKEND)
|
||||
|
||||
# 'namedserverfilter' test
|
||||
add_test_executable(namedserverfilter.cpp namedserverfilter namedserverfilter LABELS namedserverfilter LIGHT REPL_BACKEND)
|
||||
|
||||
|
48
maxscale-system-test/cnf/maxscale.cnf.template.mxs1295
Normal file
48
maxscale-system-test/cnf/maxscale.cnf.template.mxs1295
Normal file
@ -0,0 +1,48 @@
|
||||
[maxscale]
|
||||
threads=###threads###
|
||||
|
||||
[MySQL Monitor]
|
||||
type=monitor
|
||||
module=mysqlmon
|
||||
###repl51###
|
||||
servers=server1,server2
|
||||
user=maxskysql
|
||||
passwd=skysql
|
||||
monitor_interval=1000
|
||||
|
||||
[RW Split Router]
|
||||
type=service
|
||||
router=readwritesplit
|
||||
servers=server1,server2
|
||||
user=maxskysql
|
||||
passwd=skysql
|
||||
strict_multi_stmt=false
|
||||
strict_sp_calls=true
|
||||
|
||||
[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=###node_server_IP_1###
|
||||
port=###node_server_port_1###
|
||||
protocol=MySQLBackend
|
||||
|
||||
[server2]
|
||||
type=server
|
||||
address=###node_server_IP_2###
|
||||
port=###node_server_port_2###
|
||||
protocol=MySQLBackend
|
44
maxscale-system-test/mxs1295_sp_call.cpp
Normal file
44
maxscale-system-test/mxs1295_sp_call.cpp
Normal file
@ -0,0 +1,44 @@
|
||||
/**
|
||||
* Test for MXS-1295: https://jira.mariadb.org/browse/MXS-1295
|
||||
*/
|
||||
#include "testconnections.h"
|
||||
|
||||
const char sp_sql[] =
|
||||
"DROP PROCEDURE IF EXISTS multi;"
|
||||
"CREATE PROCEDURE multi()"
|
||||
"BEGIN"
|
||||
" SELECT @@server_id;"
|
||||
"END";
|
||||
|
||||
int get_server_id(MYSQL* conn)
|
||||
{
|
||||
char value[200] = "";
|
||||
find_field(conn, "SELECT @@server_id", "@@server_id", value);
|
||||
return atoi(value);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
TestConnections test(argc, argv);
|
||||
|
||||
test.connect_maxscale();
|
||||
test.repl->connect();
|
||||
|
||||
test.tprintf("Create the stored procedure and check that it works");
|
||||
test.try_query(test.repl->nodes[0], sp_sql);
|
||||
test.try_query(test.repl->nodes[0], "CALL multi()");
|
||||
|
||||
test.tprintf("Check that queries after a CALL command get routed to the master");
|
||||
|
||||
int master = get_server_id(test.repl->nodes[0]);
|
||||
int slave = get_server_id(test.repl->nodes[1]);
|
||||
int result = get_server_id(test.conn_rwsplit);
|
||||
|
||||
test.add_result(result != slave, "The query should be routed to a slave(%d): %d", slave, result);
|
||||
test.try_query(test.conn_rwsplit, "USE test");
|
||||
test.try_query(test.conn_rwsplit, "CALL multi()");
|
||||
result = get_server_id(test.conn_rwsplit);
|
||||
test.add_result(result != master, "The query should be routed to the master(%d): %d", master, result);
|
||||
|
||||
return test.global_result;
|
||||
}
|
Reference in New Issue
Block a user