本文整理汇总了C++中TestConnections::stop_maxscale方法的典型用法代码示例。如果您正苦于以下问题:C++ TestConnections::stop_maxscale方法的具体用法?C++ TestConnections::stop_maxscale怎么用?C++ TestConnections::stop_maxscale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestConnections
的用法示例。
在下文中一共展示了TestConnections::stop_maxscale方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
TestConnections::skip_maxscale_start(true);
TestConnections * Test = new TestConnections(argc, argv);
int local_result;
char str[4096];
char sql[4096];
char pass_file[4096];
char deny_file[4096];
char rules_dir[4096];
FILE* file;
sprintf(rules_dir, "%s/fw/", test_dir);
int N = 10;
int i;
for (i = 1; i < N + 1; i++)
{
Test->set_timeout(180);
local_result = 0;
Test->stop_maxscale();
sprintf(str, "rules%d", i);
copy_rules(Test, str, rules_dir);
Test->start_maxscale();
Test->connect_rwsplit();
sprintf(pass_file, "%s/fw/pass%d", test_dir, i);
sprintf(deny_file, "%s/fw/deny%d", test_dir, i);
Test->tprintf("Pass file: %s\n", pass_file);
Test->tprintf("Deny file: %s\n", deny_file);
file = fopen(pass_file, "r");
if (file != NULL)
{
Test->tprintf("********** Trying queries that should be OK ********** \n");
while (fgets(sql, sizeof(sql), file))
{
if (strlen(sql) > 1)
{
Test->tprintf("%s", sql);
local_result += execute_query(Test->conn_rwsplit, sql);
}
}
fclose(file);
}
else
{
Test->add_result(1, "Error opening query file\n");
}
file = fopen(deny_file, "r");
if (file != NULL)
{
Test->tprintf("********** Trying queries that should FAIL ********** \n");
while (fgets(sql, sizeof(sql), file))
{
Test->set_timeout(180);
if (strlen(sql) > 1)
{
Test->tprintf("%s", sql);
execute_query(Test->conn_rwsplit, sql);
if (mysql_errno(Test->conn_rwsplit) != 1141)
{
Test->tprintf("Query succeded, but fail expected, errono is %d\n", mysql_errno(Test->conn_rwsplit));
local_result++;
}
}
}
fclose(file);
}
else
{
Test->add_result(1, "Error opening query file\n");
}
if (local_result != 0)
{
Test->add_result(1, "********** rules%d test FAILED\n", i);
}
else
{
Test->tprintf("********** rules%d test PASSED\n", i);
}
mysql_close(Test->conn_rwsplit);
}
Test->set_timeout(180);
Test->stop_maxscale();
// Test for at_times clause
Test->tprintf("Trying at_times clause\n");
copy_rules(Test, (char *) "rules_at_time", rules_dir);
Test->tprintf("DELETE quries without WHERE clause will be blocked during next 2 minutes\n");
Test->tprintf("Put time to rules.txt: %s\n", str);
Test->ssh_maxscale(false, "start_time=`date +%%T`; stop_time=` date --date "
"\"now +2 mins\" +%%T`; %s sed -i \"s/###time###/$start_time-$stop_time/\" %s/rules/rules.txt",
//.........这里部分代码省略.........