Test lazy_connect
The test makes sure the various corner cases are covered by the test suite.
This commit is contained in:
parent
5960bb5e61
commit
ef25eceb78
@ -961,6 +961,9 @@ add_test_executable(mxs2414_host_blocking.cpp mxs2414_host_blocking replication
|
||||
# PAM authentication
|
||||
add_test_executable(pam_authentication.cpp pam_authentication pam_authentication LABELS REPL_BACKEND)
|
||||
|
||||
# MXS-2350: On-demand connection creation
|
||||
add_test_executable(mxs2350_lazy_connect.cpp mxs2350_lazy_connect mxs2350_lazy_connect LABELS REPL_BACKEND)
|
||||
|
||||
############################################
|
||||
# BEGIN: binlogrouter and avrorouter tests #
|
||||
############################################
|
||||
|
26
maxscale-system-test/cnf/maxscale.cnf.template.mxs2350_lazy_connect
Executable file
26
maxscale-system-test/cnf/maxscale.cnf.template.mxs2350_lazy_connect
Executable file
@ -0,0 +1,26 @@
|
||||
[maxscale]
|
||||
threads=###threads###
|
||||
|
||||
###server###
|
||||
|
||||
[MySQL-Monitor]
|
||||
type=monitor
|
||||
module=mysqlmon
|
||||
servers=###server_line###
|
||||
user=maxskysql
|
||||
password=skysql
|
||||
monitor_interval=1000
|
||||
|
||||
[RW-Split-Router]
|
||||
type=service
|
||||
router=readwritesplit
|
||||
servers=###server_line###
|
||||
user=maxskysql
|
||||
password=skysql
|
||||
lazy_connect=true
|
||||
|
||||
[RW-Split-Listener]
|
||||
type=listener
|
||||
service=RW-Split-Router
|
||||
protocol=MySQLClient
|
||||
port=4006
|
39
maxscale-system-test/mxs2350_lazy_connect.cpp
Normal file
39
maxscale-system-test/mxs2350_lazy_connect.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
/**
|
||||
* MXS-2350: On-demand connection creation
|
||||
* https://jira.mariadb.org/browse/MXS-2350
|
||||
*/
|
||||
|
||||
#include "testconnections.h"
|
||||
#include <maxbase/string.hh>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
TestConnections test(argc, argv);
|
||||
Connection c = test.maxscales->rwsplit();
|
||||
|
||||
test.expect(c.connect(), "Connection should work");
|
||||
auto output = test.maxscales->ssh_output("maxctrl list servers --tsv|cut -f 4|sort|uniq").second;
|
||||
mxb::trim(output);
|
||||
test.expect(output == "0", "Servers should have no connections: %s", output.c_str());
|
||||
c.disconnect();
|
||||
|
||||
test.expect(c.connect(), "Connection should work");
|
||||
test.expect(c.query("SELECT 1"), "Read should work");
|
||||
c.disconnect();
|
||||
|
||||
test.expect(c.connect(), "Connection should work");
|
||||
test.expect(c.query("SELECT @@last_insert_id"), "Write should work");
|
||||
c.disconnect();
|
||||
|
||||
test.expect(c.connect(), "Connection should work");
|
||||
test.expect(c.query("SET @a = 1"), "Session command should work");
|
||||
c.disconnect();
|
||||
|
||||
test.expect(c.connect(), "Connection should work");
|
||||
test.expect(c.query("BEGIN"), "BEGIN should work");
|
||||
test.expect(c.query("SELECT 1"), "Read should work");
|
||||
test.expect(c.query("COMMIT"), "COMMIT command should work");
|
||||
c.disconnect();
|
||||
|
||||
return test.global_result;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user