本文整理汇总了C++中TestConnections类的典型用法代码示例。如果您正苦于以下问题:C++ TestConnections类的具体用法?C++ TestConnections怎么用?C++ TestConnections使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TestConnections类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
int OldMaster;
int NewMaster;
if (argc != 3)
{
printf("Usage: change_master NewMasterNode OldMasterNode\n");
exit(1);
}
TestConnections * Test = new TestConnections(argc, argv);
sscanf(argv[1], "%d", &NewMaster);
sscanf(argv[2], "%d", &OldMaster);
Test->tprintf("Changing master from node %d (%s) to node %d (%s)\n", OldMaster, Test->repl->IP[OldMaster],
NewMaster, Test->repl->IP[NewMaster]);
Test->repl->connect();
Test->repl->change_master(NewMaster, OldMaster);
Test->repl->close_connections();
int rval = Test->global_result;
delete Test;
return rval;
}
示例2: main
int main(int argc, char *argv[])
{
TestConnections * Test = new TestConnections(argc, argv);
int global_result = 0;
Test->read_env();
Test->print_env();
Test->binlog_cmd_option = 2;
Test->start_binlog();
Test->repl->connect();
create_t1(Test->repl->nodes[0]);
global_result += insert_into_t1(Test->repl->nodes[0], 4);
printf("Sleeping to let replication happen\n"); fflush(stdout);
sleep(30);
for (int i = 0; i < Test->repl->N; i++) {
printf("Checking data from node %d (%s)\n", i, Test->repl->IP[i]); fflush(stdout);
global_result += select_from_t1(Test->repl->nodes[i], 4);
}
Test->repl->close_connections();
Test->copy_all_logs(); return(global_result);
}
示例3: main
int main(int argc, char *argv[])
{
int global_result = 0;
int OldMaster;
int NewMaster;
if (argc !=3) {
printf("Usage: change_master NewMasterNode OldMasterNode\n");
exit(1);
}
TestConnections * Test = new TestConnections(argc, argv);
Test->read_env();
Test->print_env();
sscanf(argv[1], "%d", &NewMaster);
sscanf(argv[2], "%d", &OldMaster);
printf("Changing master from node %d (%s) to node %d (%s)\n", OldMaster, Test->repl->IP[OldMaster], NewMaster, Test->repl->IP[NewMaster]);
Test->repl->connect();
Test->repl->change_master(NewMaster, OldMaster);
Test->repl->close_connections();
Test->copy_all_logs(); return(global_result);
}
示例4: main
int main(int argc, char *argv[])
{
TestConnections * Test = new TestConnections(argc, argv);
int global_result = 0;
Test->print_env();
global_result += execute_maxadmin_command_print(Test->maxscale_IP, (char *) "admin", Test->maxadmin_password, (char *) "show servers");
Test->copy_all_logs(); return(global_result);
}
示例5: main
int main(int argc, char *argv[])
{
TestConnections * Test = new TestConnections(argc, argv);
Test->set_timeout(30);
Test->check_log_err((char *) "Unexpected parameter 'укпоукц'", true);
Test->check_log_err((char *) "Unexpected parameter 'hren'", true);
Test->check_maxscale_processes(0);
int rval = Test->global_result;
delete Test;
return rval;
}
示例6: main
int main(int argc, char *argv[])
{
TestConnections * Test = new TestConnections(argc, argv);
int global_result = 0;
Test->read_env();
Test->print_env();
printf("Connecting to RWSplit %s\n", Test->maxscale_IP);
Test->connect_rwsplit();
printf("Setup firewall to block mysql on master\n"); fflush(stdout);
Test->repl->block_node(0);
printf("Trying query to RWSplit, expecting failure, but not a crash\n"); fflush(stdout);
execute_query(Test->conn_rwsplit, (char *) "show processlist;");
printf("Setup firewall back to allow mysql\n"); fflush(stdout);
Test->repl->unblock_node(0);
sleep(10);
global_result += check_maxscale_alive();
Test->close_rwsplit();
printf("Reconnecting and trying query to RWSplit\n"); fflush(stdout);
Test->connect_rwsplit();
global_result += execute_query(Test->conn_rwsplit, (char *) "show processlist;");
Test->close_rwsplit();
Test->copy_all_logs(); return(global_result);
}
示例7: main
int main(int argc, char *argv[])
{
TestConnections * Test = new TestConnections(argc, argv);
Test->connect_maxscale();
Test->set_timeout(10);
Test->tprintf("Trying SHOW GLOBAL STATUS against RWSplit\n");
Test->try_query(Test->conn_rwsplit, (char *) "SHOW GLOBAL STATUS;");
Test->tprintf("Trying SHOW GLOBAL STATUS against ReadConn master\n");
Test->try_query(Test->conn_master, (char *) "SHOW GLOBAL STATUS;");
Test->tprintf("Trying SHOW GLOBAL STATUS against ReadConn slave\n");
Test->try_query(Test->conn_slave, (char *) "SHOW GLOBAL STATUS;");
Test->check_maxscale_alive();
int rval = Test->global_result;
delete Test;
return rval;
}
示例8: main
int main(int argc, char *argv[])
{
TestConnections * Test = new TestConnections(argc, argv);
Test->set_timeout(30);
Test->ssh_maxscale(true, "maxkeys");
Test->ssh_maxscale(true, "sudo chown maxscale:maxscale /var/lib/maxscale/.secrets");
try_password(Test, (char *) "aaa$aaa");
try_password(Test, (char *) "#¤&");
try_password(Test, (char *) "пароль");
Test->check_maxscale_alive();
int rval = Test->global_result;
delete Test;
return rval;
}
示例9: main
int main(int argc, char *argv[])
{
TestConnections * Test = new TestConnections(argc, argv);
Test->set_timeout(30);
Test->galera->connect();
tolerance = 0;
// connect to the MaxScale server (rwsplit)
Test->connect_rwsplit();
Test->execute_maxadmin_command((char *) "shutdown monitor \"Galera Monitor\"");
if (Test->conn_rwsplit == NULL )
{
Test->add_result(1, "Can't connect to MaxScale\n");
int rval = Test->global_result;
delete Test;
exit(1);
}
else
{
Test->try_query(Test->conn_rwsplit, "DROP TABLE IF EXISTS t1;");
Test->try_query(Test->conn_rwsplit, "create table t1 (x1 int);");
get_global_status_allnodes(&selects[0], &inserts[0], Test->galera, silent);
Test->try_query(Test->conn_rwsplit, "select * from t1;");
get_global_status_allnodes(&new_selects[0], &new_inserts[0], Test->galera, silent);
print_delta(&new_selects[0], &new_inserts[0], &selects[0], &inserts[0], Test->galera->N);
Test->try_query(Test->conn_rwsplit, "insert into t1 values(1);");
get_global_status_allnodes(&new_selects[0], &new_inserts[0], Test->galera, silent);
print_delta(&new_selects[0], &new_inserts[0], &selects[0], &inserts[0], Test->galera->N);
// close connections
Test->close_rwsplit();
}
Test->galera->close_connections();
int rval = Test->global_result;
delete Test;
return rval;
}
示例10: main
int main(int argc, char *argv[])
{
TestConnections * Test = new TestConnections(argc, argv);
Test->tprintf("Trying 11 connections with RWSplit\n");
check_max_conn(0, 10, Test);
Test->tprintf("Trying 21 connections with Readconn master\n");
check_max_conn(1, 20, Test);
Test->tprintf("Trying 26 connections with Readconnn slave\n");
check_max_conn(2, 25, Test);
sleep(10);
Test->check_maxscale_alive();
int rval = Test->global_result;
delete Test;
return rval;
}
示例11: main
int main(int argc, char *argv[])
{
TestConnections *test = new TestConnections(argc, argv);
Config config(test);
config.create_all_listeners();
config.create_all_listeners();
test->check_maxscale_processes(1);
config.create_monitor("mysql-monitor", "mysqlmon", 500);
config.reset();
sleep(1);
test->check_maxscale_alive();
int rval = test->global_result;
delete test;
return rval;
}
示例12: main
int main(int argc, char *argv[])
{
TestConnections * Test = new TestConnections(argc, argv);
Test->set_timeout(3000);
int options_set = 3;
if (Test->smoke)
{
options_set = 1;
}
Test->repl->connect();
execute_query(Test->repl->nodes[0], (char *) "DROP TABLE IF EXISTS t1;");
Test->repl->close_connections();
sleep(5);
for (int option = 0; option < options_set; option++)
{
Test->binlog_cmd_option = option;
Test->start_binlog();
test_binlog(Test);
}
Test->check_log_err("SET NAMES utf8mb4", false);
Test->check_log_err("set autocommit=1", false);
Test->check_log_err("select USER()", false);
int rval = Test->global_result;
delete Test;
return rval;
}
示例13: main
int main(int argc, char *argv[])
{
TestConnections * Test = new TestConnections(argc, argv);
int global_result = 0;
Test->read_env();
Test->print_env();
Test->connect_maxscale();
printf("Trying SELECT @a:[email protected]+1 as a, test.b FROM test\n"); fflush(stdout);
global_result += execute_query(Test->conn_rwsplit, "DROP TABLE IF EXISTS test; CREATE TABLE test (b integer);");
for (int i=0; i<10000;i++) {execute_query(Test->conn_rwsplit, "insert into test value(2);");}
if (execute_query(Test->conn_rwsplit, "SELECT @a:[email protected]+1 as a, test.b FROM test;") == 0) {
printf("Query succeded, but expected to fail. Test FAILED!\n"); fflush(stdout);
global_result++;
}
printf("Trying USE test\n"); fflush(stdout);
global_result += execute_query(Test->conn_rwsplit, "USE test");
global_result += execute_query(Test->conn_rwsplit, "DROP TABLE IF EXISTS test;");
printf("Checking if MaxScale alive\n"); fflush(stdout);
Test->close_maxscale_connections();
printf("Checking logs\n"); fflush(stdout);
global_result += check_log_err((char *) "Warning : The query can't be routed to all backend servers because it includes SELECT and SQL variable modifications which is not supported", TRUE);
global_result += check_log_err((char *) "SELECT with session data modification is not supported if configuration parameter use_sql_variables_in=all", TRUE);
global_result += check_maxscale_alive();
Test->copy_all_logs(); return(global_result);
}
示例14: main
int main(int argc, char *argv[])
{
TestConnections * Test = new TestConnections(argc, argv);
int global_result = 0;
int i;
Test->read_env();
Test->print_env();
printf("Connecting to all MaxScale services\n");
fflush(stdout);
global_result += Test->connect_maxscale();
printf("executing show status 1000 times\n");
fflush(stdout);
for (i = 0; i < 1000; i++) {
global_result += execute_query(Test->conn_rwsplit, (char *) "show status");
}
for (i = 0; i < 1000; i++) {
global_result += execute_query(Test->conn_slave, (char *) "show status");
}
for (i = 0; i < 1000; i++) {
global_result += execute_query(Test->conn_master, (char *) "show status");
}
Test->close_maxscale_connections();
check_maxscale_alive();
Test->copy_all_logs();
return(global_result);
}
示例15: main
int main(int argc, char *argv[])
{
TestConnections * Test = new TestConnections(argc, argv);
int global_result = 0;
Test->print_env();
Test->connect_maxscale();
printf("RWSplit: \n"); fflush(stdout);
global_result = execute_query(Test->conn_rwsplit, (char *) "SET OPTION SQL_QUOTE_SHOW_CREATE = 1;");
printf("ReadConn master: \n"); fflush(stdout);
global_result = execute_query(Test->conn_master, (char *) "SET OPTION SQL_QUOTE_SHOW_CREATE = 1;");
printf("readConn slave: \n"); fflush(stdout);
global_result = execute_query(Test->conn_slave, (char *) "SET OPTION SQL_QUOTE_SHOW_CREATE = 1;");
Test->close_maxscale_connections();
global_result += check_maxscale_alive();
Test->copy_all_logs(); return(global_result);
}