doc and astyle fixes
This commit is contained in:

committed by
Markus Mäkelä

parent
0ce183d7e3
commit
4fd6d075cb
@ -49,8 +49,8 @@ int main(int argc, char *argv[])
|
||||
test.set_timeout(120);
|
||||
|
||||
char * output = test.maxscales->ssh_node_output(0,
|
||||
"maxavrocheck -d /var/lib/maxscale/avro/test.t1.000001.avro",
|
||||
true, &exit_code);
|
||||
"maxavrocheck -d /var/lib/maxscale/avro/test.t1.000001.avro",
|
||||
true, &exit_code);
|
||||
|
||||
std::istringstream iss;
|
||||
iss.str(output);
|
||||
|
@ -63,7 +63,7 @@ int main(int argc, char *argv[])
|
||||
char result[1024];
|
||||
|
||||
Test->maxscales->get_maxadmin_param(0, (char *) "show dbusers RW Split Router", (char *) "Incorrect number of arguments:",
|
||||
result);
|
||||
result);
|
||||
Test->tprintf("result %s\n", result);
|
||||
|
||||
if (strstr(result, "show dbusers expects 1 argument") == NULL)
|
||||
|
@ -18,9 +18,9 @@ bool try_connect(TestConnections& test)
|
||||
bool rval = false;
|
||||
|
||||
if (rwsplit && master && slave &&
|
||||
execute_query(rwsplit, "SELECT 1") == 0 &&
|
||||
execute_query(master, "SELECT 1") == 0 &&
|
||||
execute_query(slave, "SELECT 1") == 0)
|
||||
execute_query(rwsplit, "SELECT 1") == 0 &&
|
||||
execute_query(master, "SELECT 1") == 0 &&
|
||||
execute_query(slave, "SELECT 1") == 0)
|
||||
|
||||
{
|
||||
rval = true;
|
||||
|
@ -17,7 +17,7 @@ int create_key(TestConnections *test)
|
||||
true);
|
||||
test->maxscales->ssh_node(0, "maxkeys", true);
|
||||
char *result = test->maxscales->ssh_node_output(0, "sudo test -f /var/lib/maxscale/.secrets && echo SUCCESS",
|
||||
false, &exit_code);
|
||||
false, &exit_code);
|
||||
|
||||
if (strncmp(result, "SUCCESS", 7) != 0)
|
||||
{
|
||||
|
@ -23,11 +23,11 @@ void get_output(TestConnections& test)
|
||||
test.tprintf("MaxScale output:");
|
||||
}
|
||||
output = test.maxscales->ssh_node_output(0, "cat /var/log/maxscale/maxscale.log && "
|
||||
"sudo truncate -s 0 /var/log/maxscale/maxscale.log",
|
||||
true, &ec);
|
||||
"sudo truncate -s 0 /var/log/maxscale/maxscale.log",
|
||||
true, &ec);
|
||||
if (test.verbose)
|
||||
{
|
||||
test.tprintf("%s", output);
|
||||
test.tprintf("%s", output);
|
||||
}
|
||||
free(output);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ int prepare_test_1(TestConnections& test)
|
||||
{
|
||||
cout << LINE << endl;
|
||||
cout << "Part 1: Stopping master and waiting for failover. Check that another server is promoted." <<
|
||||
endl;
|
||||
endl;
|
||||
cout << LINE << endl;
|
||||
int node0_id = test.repl->get_server_id(0); // Read master id now before shutdown.
|
||||
test.repl->stop_node(0);
|
||||
@ -76,7 +76,7 @@ void prepare_test_2(TestConnections& test)
|
||||
{
|
||||
cout << LINE << endl;
|
||||
cout << "Part 2: Disable replication on server 2 and kill master, check that server 3 or 4 is promoted."
|
||||
<< endl;
|
||||
<< endl;
|
||||
cout << LINE << endl;
|
||||
test.repl->connect();
|
||||
check(test);
|
||||
@ -120,8 +120,8 @@ void prepare_test_3(TestConnections& test)
|
||||
{
|
||||
cout << LINE << "\n";
|
||||
cout << "Part 3: Disable log_bin on server 2, making it invalid for promotion. Enable log-slave-updates "
|
||||
" on servers 2 and 4. Disable log-slave-updates on server 3. Check that server 4 is promoted on"
|
||||
" master failure." << "\n" << LINE << endl;
|
||||
" on servers 2 and 4. Disable log-slave-updates on server 3. Check that server 4 is promoted on"
|
||||
" master failure." << "\n" << LINE << endl;
|
||||
get_output(test);
|
||||
test.maxscales->stop_maxscale(0);
|
||||
test.repl->stop_node(1);
|
||||
|
@ -203,7 +203,7 @@ int main(int argc, char *argv[])
|
||||
elapsedTime += (double) (t2.tv_usec - t1.tv_usec) / 1000000.0;
|
||||
}
|
||||
while ((execute_query_silent(Test->maxscales->conn_rwsplit[0], "SELECT * FROM t1") != 0) &&
|
||||
(elapsedTime < 10));
|
||||
(elapsedTime < 10));
|
||||
|
||||
Test->tprintf("Quries were blocked during %f (using clock_gettime())", elapsedTime);
|
||||
Test->tprintf("Quries were blocked during %lu (using time())", time(NULL) - start_time_clock);
|
||||
|
@ -34,7 +34,7 @@ int read_and_execute_queries(TestConnections *Test, const char* filename, int ex
|
||||
{
|
||||
Test->tprintf("%s", sql);
|
||||
if (execute_query(Test->maxscales->conn_rwsplit[0], sql) != expected &&
|
||||
(expected == 1 || mysql_errno(Test->maxscales->conn_rwsplit[0]) == 1141))
|
||||
(expected == 1 || mysql_errno(Test->maxscales->conn_rwsplit[0]) == 1141))
|
||||
{
|
||||
Test->tprintf("Query %s, but %s expected, MySQL error: %d, %s\n",
|
||||
expected ? "succeeded" : "failed",
|
||||
|
@ -101,7 +101,7 @@ int main(int argc, char *argv[])
|
||||
copy_rules(Test, (char *) "rules_syntax_error", rules_dir);
|
||||
|
||||
char *output = Test->maxscales->ssh_node_output(0,
|
||||
"maxadmin call command dbfwfilter rules/reload Database-Firewall", true, &exit_code);
|
||||
"maxadmin call command dbfwfilter rules/reload Database-Firewall", true, &exit_code);
|
||||
Test->add_result(strcasestr(output, "Failed") == NULL, "Reloading rules should fail with syntax errors");
|
||||
|
||||
Test->check_maxscale_processes(0, 1);
|
||||
|
@ -34,15 +34,15 @@ void configure_keepalived(TestConnections* Test, char * keepalived_file)
|
||||
for (i = 0; i < Test->maxscales->N; i++)
|
||||
{
|
||||
std::string src = std::string(test_dir)
|
||||
+ "/keepalived_cnf/"
|
||||
+ std::string(keepalived_file)
|
||||
+ std::to_string(i + 1)
|
||||
+ ".conf";
|
||||
+ "/keepalived_cnf/"
|
||||
+ std::string(keepalived_file)
|
||||
+ std::to_string(i + 1)
|
||||
+ ".conf";
|
||||
std::string cp_cmd = "cp "
|
||||
+ std::string(Test->maxscales->access_homedir[i])
|
||||
+ std::string(keepalived_file)
|
||||
+ std::to_string(i + 1) + ".conf "
|
||||
+ " /etc/keepalived/keepalived.conf";
|
||||
+ std::string(Test->maxscales->access_homedir[i])
|
||||
+ std::string(keepalived_file)
|
||||
+ std::to_string(i + 1) + ".conf "
|
||||
+ " /etc/keepalived/keepalived.conf";
|
||||
Test->tprintf("%s\n", src.c_str());
|
||||
Test->tprintf("%s\n", cp_cmd.c_str());
|
||||
Test->maxscales->ssh_node(i, "yum install -y keepalived", true);
|
||||
|
@ -63,7 +63,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
print_version_string(Test);
|
||||
|
||||
sleep(FAILOVER_WAIT_TIME);sleep(FAILOVER_WAIT_TIME);
|
||||
sleep(FAILOVER_WAIT_TIME);
|
||||
sleep(FAILOVER_WAIT_TIME);
|
||||
|
||||
// initial state: 000 expected to be active, 001 - passive
|
||||
passive = check_maxscale_passive(Test, 0);
|
||||
|
@ -61,7 +61,7 @@ int main(int argc, char *argv[])
|
||||
Test->maxscales->ssh_node(0, (char *) "yum install rng-tools -y", true);
|
||||
Test->maxscales->ssh_node(0, (char *) "rngd -r /dev/urandom -o /dev/random", true);
|
||||
Test->maxscales->ssh_node(0, (char *)
|
||||
"yum install -y MariaDB-gssapi-server MariaDB-gssapi-client krb5-server krb5-workstation pam_krb5", true);
|
||||
"yum install -y MariaDB-gssapi-server MariaDB-gssapi-client krb5-server krb5-workstation pam_krb5", true);
|
||||
|
||||
Test->maxscales->ssh_node_f(0, true, (char *)
|
||||
"yum install -y MariaDB-gssapi-server MariaDB-gssapi-client krb5-server krb5-workstation pam_krb5", true);
|
||||
|
@ -51,7 +51,7 @@ MYSQL* open_conn_db_flags(int port, std::string ip, std::string db, std::string
|
||||
}
|
||||
|
||||
MYSQL* open_conn_db_timeout(int port, std::string ip, std::string db, std::string user, std::string password,
|
||||
unsigned int timeout, bool ssl)
|
||||
unsigned int timeout, bool ssl)
|
||||
{
|
||||
MYSQL* conn = mysql_init(NULL);
|
||||
|
||||
@ -542,7 +542,8 @@ Result get_result(MYSQL* conn, std::string sql)
|
||||
Row get_row(MYSQL* conn, std::string sql)
|
||||
{
|
||||
Result res = get_result(conn, sql);
|
||||
return res.empty() ? Row{} : res[0];
|
||||
return res.empty() ? Row{} :
|
||||
res[0];
|
||||
}
|
||||
|
||||
int get_int_version(std::string version)
|
||||
|
@ -75,7 +75,7 @@ MYSQL* open_conn_db_timeout(int port, std::string ip, std::string db, std::strin
|
||||
* @return MYSQL struct
|
||||
*/
|
||||
static MYSQL* open_conn_db(int port, std::string ip, std::string db, std::string user, std::string password,
|
||||
bool ssl = false)
|
||||
bool ssl = false)
|
||||
{
|
||||
return open_conn_db_flags(port, ip, db, user, password, CLIENT_MULTI_STATEMENTS, ssl);
|
||||
}
|
||||
|
@ -229,9 +229,9 @@ int Mariadb_nodes::find_master()
|
||||
while ((found == 0) && (i < N))
|
||||
{
|
||||
if (find_field(
|
||||
nodes[i], (char *) "show slave status;",
|
||||
(char *) "Master_Host", &str[0]
|
||||
) == 0 )
|
||||
nodes[i], (char *) "show slave status;",
|
||||
(char *) "Master_Host", &str[0]
|
||||
) == 0 )
|
||||
{
|
||||
found = 1;
|
||||
strcpy(master_IP, str);
|
||||
@ -714,7 +714,7 @@ static bool multi_source_replication(MYSQL *conn, int node)
|
||||
MYSQL_RES *res;
|
||||
|
||||
if (mysql_query(conn, "SHOW ALL SLAVES STATUS") == 0 &&
|
||||
(res = mysql_store_result(conn)))
|
||||
(res = mysql_store_result(conn)))
|
||||
{
|
||||
if (mysql_num_rows(res) == 1)
|
||||
{
|
||||
|
@ -15,7 +15,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
Test->set_timeout(50);
|
||||
char *user = Test->maxscales->ssh_node_output(0, "ps -FC maxscale|tail -n 1|cut -f 1 -d \" \"", false,
|
||||
&exit_code);
|
||||
&exit_code);
|
||||
char *nl = user ? strchr(user, '\n') : NULL;
|
||||
|
||||
if (nl)
|
||||
|
@ -22,7 +22,7 @@ Test setup is described in template. Templates are stored in
|
||||
Own template have to be put to the same directory.
|
||||
|
||||
Default environment for tests consists of:
|
||||
* one VM for Maxscale
|
||||
* 2 VMs for Maxscales
|
||||
* 4 VMs for master/slave setup
|
||||
* 4 VMs for Galera cluster
|
||||
|
||||
@ -35,6 +35,7 @@ Template name|Description
|
||||
---|---
|
||||
```nogalera``` |only 1 VM for Maxscale and 4 for Master/Slaves|
|
||||
```twomaxscales``` |2 VMs for Maxscale and 4 for Master/Slaves|
|
||||
```onemaxscale``` |1 VM for Maxscale, 4 for Master/Slaves and 4 for Galera|
|
||||
```big``` |1 VM for Maxscale, 8 for Master/Slaves and 4 for Galera|
|
||||
```big15``` |1 VM for Maxscale, 15 for Master/Slaves and 4 for Galera|
|
||||
|
||||
|
@ -8,7 +8,7 @@ echo "MDBCI_VM_PATH=$MDBCI_VM_PATH"
|
||||
export box=${box:-"centos_7_libvirt"}
|
||||
echo "box=$box"
|
||||
|
||||
export template=${template:-"twomaxscales_full"}
|
||||
export template=${template:-"default"}
|
||||
|
||||
export curr_date=`date '+%Y-%m-%d_%H-%M'`
|
||||
|
||||
|
@ -104,7 +104,19 @@
|
||||
}
|
||||
},
|
||||
|
||||
"maxscale" :
|
||||
"maxscale_000" :
|
||||
{
|
||||
"hostname" : "maxscale",
|
||||
"box" : "${box}",
|
||||
"memory_size" : "${vm_memory}",
|
||||
"product" : {
|
||||
"name" : "maxscale_ci",
|
||||
"version" : "${target}"
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
"maxscale_001" :
|
||||
{
|
||||
"hostname" : "maxscale",
|
||||
"box" : "${box}",
|
||||
|
@ -104,19 +104,7 @@
|
||||
}
|
||||
},
|
||||
|
||||
"maxscale_000" :
|
||||
{
|
||||
"hostname" : "maxscale",
|
||||
"box" : "${box}",
|
||||
"memory_size" : "${vm_memory}",
|
||||
"product" : {
|
||||
"name" : "maxscale_ci",
|
||||
"version" : "${target}"
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
"maxscale_001" :
|
||||
"maxscale" :
|
||||
{
|
||||
"hostname" : "maxscale",
|
||||
"box" : "${box}",
|
@ -27,10 +27,10 @@ int main(int argc, char *argv[])
|
||||
Test->maxscales->copy_to_node_legacy(cache_rules.c_str(), "~/", 0);
|
||||
|
||||
Test->maxscales->ssh_node_f(0, true, "cd %s;"
|
||||
"rm -rf rules;"
|
||||
"mkdir rules;"
|
||||
"chown vagrant:vagrant rules",
|
||||
Test->maxscales->access_homedir[0]);
|
||||
"rm -rf rules;"
|
||||
"mkdir rules;"
|
||||
"chown vagrant:vagrant rules",
|
||||
Test->maxscales->access_homedir[0]);
|
||||
copy_rules(Test, "rules2", fw_rules.c_str());
|
||||
|
||||
Test->maxscales->start_maxscale(0);
|
||||
|
@ -23,11 +23,11 @@ int main(int argc, char** argv)
|
||||
// Wait for the data to be processed
|
||||
const char* logmsg = "Waiting until more data is written";
|
||||
test.maxscales->ssh_node_f(0, true,
|
||||
"for ((i=0;i<15;i++)); do grep '%s' /var/log/maxscale/maxscale.log && break || sleep 1; done", logmsg);
|
||||
"for ((i=0;i<15;i++)); do grep '%s' /var/log/maxscale/maxscale.log && break || sleep 1; done", logmsg);
|
||||
|
||||
// Check if the Avro file contains the inserted value
|
||||
int rc = test.maxscales->ssh_node_f(0, true,
|
||||
"maxavrocheck -d /var/lib/maxscale/avro/test.t1.000001.avro|grep 'Hello World'");
|
||||
"maxavrocheck -d /var/lib/maxscale/avro/test.t1.000001.avro|grep 'Hello World'");
|
||||
test.add_result(rc == 0, "Data is converted when a failure to convert is expected");
|
||||
|
||||
printf("\n"
|
||||
|
@ -36,22 +36,22 @@ int main(int argc, char** argv)
|
||||
test.tprintf("Trying query that matches one 'user' row, expecting failure\n");
|
||||
test.set_timeout(30);
|
||||
test.add_result(!execute_query(test.maxscales->conn_rwsplit[0], "select concat(a) from t"),
|
||||
"Query that matches one 'user' row should fail.\n");
|
||||
"Query that matches one 'user' row should fail.\n");
|
||||
|
||||
test.tprintf("Trying query that matches other 'user' row, expecting failure\n");
|
||||
test.set_timeout(30);
|
||||
test.add_result(!execute_query(test.maxscales->conn_rwsplit[0], "select concat(b) from t"),
|
||||
"Query that matches other 'user' row should fail.\n");
|
||||
"Query that matches other 'user' row should fail.\n");
|
||||
|
||||
test.tprintf("Trying query that matches both 'user' rows, expecting failure\n");
|
||||
test.set_timeout(30);
|
||||
test.add_result(!execute_query_silent(test.maxscales->conn_rwsplit[0], "select concat(a), concat(b) from t"),
|
||||
"Query that matches both 'user' rows should fail.\n");
|
||||
"Query that matches both 'user' rows should fail.\n");
|
||||
|
||||
test.tprintf("Trying non-matching query to blacklisted RWSplit, expecting success\n");
|
||||
test.set_timeout(30);
|
||||
test.add_result(execute_query_silent(test.maxscales->conn_rwsplit[0], "show status"),
|
||||
"Non-matching query to blacklist service should succeed.\n");
|
||||
"Non-matching query to blacklist service should succeed.\n");
|
||||
|
||||
test.stop_timeout();
|
||||
test.tprintf("Checking if MaxScale is alive\n");
|
||||
|
@ -21,7 +21,7 @@ void* query_thr(void* data)
|
||||
while (running)
|
||||
{
|
||||
if (mysql_query(mysql, "INSERT INTO test.mxs1585 VALUES (1)") ||
|
||||
mysql_query(mysql, "DELETE FROM test.mxs1585 LIMIT 100"))
|
||||
mysql_query(mysql, "DELETE FROM test.mxs1585 LIMIT 100"))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -19,9 +19,11 @@ int main(int argc, char *argv[])
|
||||
std::vector<uint8_t> wbuf;
|
||||
auto it = std::back_inserter(wbuf);
|
||||
|
||||
for (auto a: {(uint8_t)(caps), (uint8_t)(caps >> 8), (uint8_t)(caps >> 16), (uint8_t)(caps >> 24),
|
||||
for (auto a: {
|
||||
(uint8_t)(caps), (uint8_t)(caps >> 8), (uint8_t)(caps >> 16), (uint8_t)(caps >> 24),
|
||||
(uint8_t)(max_packet), (uint8_t)(max_packet >> 8), (uint8_t)(max_packet >> 16), (uint8_t)(max_packet >> 24),
|
||||
charset})
|
||||
charset
|
||||
})
|
||||
{
|
||||
*it++ = a;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ int main(int argc, char** argv)
|
||||
MYSQL* conn = open_conn_db(test.maxscales->port(), test.maxscales->ip(), db,
|
||||
test.maxscales->user_name, test.maxscales->password);
|
||||
if (execute_query_silent(conn, "SELECT 1") ||
|
||||
execute_query_silent(conn, "SHOW DATABASES"))
|
||||
execute_query_silent(conn, "SHOW DATABASES"))
|
||||
{
|
||||
errors.insert(mysql_error(conn));
|
||||
}
|
||||
@ -45,7 +45,9 @@ int main(int argc, char** argv)
|
||||
|
||||
test.assert(errors.empty(), "None of the queries should fail: %s",
|
||||
std::accumulate(errors.begin(), errors.end(), std::string(),
|
||||
[](const std::string &a, const std::string &b){return a + b + " ";}));
|
||||
[](const std::string &a, const std::string &b) {
|
||||
return a + b + " ";
|
||||
}));
|
||||
|
||||
test.tprintf("Dropping databases...");
|
||||
for (auto db : db_list)
|
||||
|
@ -86,7 +86,7 @@ int main(int argc, char* argv[])
|
||||
bool rval = true;
|
||||
|
||||
if (mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_bind_result(stmt, &bind.bind))
|
||||
mysql_stmt_bind_result(stmt, &bind.bind))
|
||||
{
|
||||
rval = false;
|
||||
}
|
||||
@ -106,10 +106,10 @@ int main(int argc, char* argv[])
|
||||
bool rval = true;
|
||||
|
||||
if (mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt))
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt))
|
||||
{
|
||||
rval = false;
|
||||
}
|
||||
@ -124,10 +124,10 @@ int main(int argc, char* argv[])
|
||||
bool rval = true;
|
||||
|
||||
if (mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_bind_result(stmt, &bind.bind))
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_bind_result(stmt, &bind.bind))
|
||||
{
|
||||
rval = false;
|
||||
}
|
||||
@ -147,10 +147,10 @@ int main(int argc, char* argv[])
|
||||
bool rval = true;
|
||||
|
||||
if (mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_bind_result(stmt, &bind.bind))
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_bind_result(stmt, &bind.bind))
|
||||
{
|
||||
rval = false;
|
||||
}
|
||||
@ -170,11 +170,11 @@ int main(int argc, char* argv[])
|
||||
bool rval = true;
|
||||
|
||||
if (mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_query(conn, "SET @a = 1"))
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_stmt_execute(stmt) ||
|
||||
mysql_query(conn, "SET @a = 1"))
|
||||
{
|
||||
rval = false;
|
||||
}
|
||||
|
@ -12,7 +12,9 @@ void checkpoint(TestConnections& test)
|
||||
const int v = 5;
|
||||
test.maxscales->wait_for_monitor(v);
|
||||
|
||||
for (auto&& s: {"server1", "server2", "server3"})
|
||||
for (auto&& s: {
|
||||
"server1", "server2", "server3"
|
||||
})
|
||||
{
|
||||
auto status = test.get_server_status(s);
|
||||
cout << s << " { ";
|
||||
|
@ -31,7 +31,7 @@ void add_remove_maxadmin_user(TestConnections* Test)
|
||||
|
||||
Test->tprintf("enable account %s to maxadmin:\n", Test->maxscales->access_user[0]);
|
||||
char * st3 = Test->maxscales->ssh_node_output_f(0, true, &exit_code, "maxadmin enable account %s",
|
||||
Test->maxscales->access_user[0]);
|
||||
Test->maxscales->access_user[0]);
|
||||
Test->tprintf("Result: %s\n", st3);
|
||||
sprintf(str, user_added, Test->maxscales->access_user[0]);
|
||||
if (strstr(st3, str) == NULL)
|
||||
@ -85,7 +85,7 @@ void add_remove_maxadmin_user(TestConnections* Test)
|
||||
|
||||
Test->tprintf("trying to remove user '%s'\n", Test->maxscales->access_user[0]);
|
||||
char * st8 = Test->maxscales->ssh_node_output_f(0, false, &exit_code, "maxadmin disable account %s",
|
||||
Test->maxscales->access_user[0]);
|
||||
Test->maxscales->access_user[0]);
|
||||
|
||||
if (strstr(st8, remove_last_admin))
|
||||
{
|
||||
@ -138,8 +138,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
Test->tprintf("trying long wierd user\n");
|
||||
Test->maxscales->ssh_node_output(0,
|
||||
"maxadmin enable account yygrgtrпрекури6н33имн756ККККЕН:УИГГГГ*?:*:*fj34oru34h275g23457g2v90590+u764gv56837fbv62381§SDFERGtrg45ergfergergefewfergt456ty",
|
||||
true, &exit_code);
|
||||
"maxadmin enable account yygrgtrпрекури6н33имн756ККККЕН:УИГГГГ*?:*:*fj34oru34h275g23457g2v90590+u764gv56837fbv62381§SDFERGtrg45ergfergergefewfergt456ty",
|
||||
true, &exit_code);
|
||||
|
||||
Test->check_maxscale_alive(0);
|
||||
Test->maxscales->ssh_node_f(0, true, "rm -rf /var/lib/maxscale/passwd");
|
||||
|
@ -25,7 +25,8 @@ int main(int argc, char** argv)
|
||||
"CREATE USER 'test2'@'%' IDENTIFIED BY 'test2'",
|
||||
"GRANT dba TO 'test'@'%'",
|
||||
"GRANT dba TO 'test2'@'%'",
|
||||
"SET DEFAULT ROLE dba FOR 'test'@'%'"}))
|
||||
"SET DEFAULT ROLE dba FOR 'test'@'%'"
|
||||
}))
|
||||
{
|
||||
test.try_query(test.repl->nodes[0], "%s", a.c_str());
|
||||
}
|
||||
@ -50,7 +51,8 @@ int main(int argc, char** argv)
|
||||
for (auto a : vector<string>({"DROP DATABASE IF EXISTS my_db",
|
||||
"DROP ROLE IF EXISTS dba",
|
||||
"DROP USER 'test'@'%'",
|
||||
"DROP USER 'test2'@'%'"}))
|
||||
"DROP USER 'test2'@'%'"
|
||||
}))
|
||||
{
|
||||
execute_query_silent(test.repl->nodes[0], "%s", a.c_str());
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ int main(int argc, char *argv[])
|
||||
int queried_id = atoi(server_id);
|
||||
|
||||
test.add_result(queried_id != real_id, "The query server ID '%d' does not match the one from server '%d'. "
|
||||
"Slave was not recovered.", queried_id, real_id);
|
||||
"Slave was not recovered.", queried_id, real_id);
|
||||
|
||||
char userval[200] = "";
|
||||
find_field(test.maxscales->conn_rwsplit[0], "SELECT @a", "@a", userval);
|
||||
|
@ -33,12 +33,12 @@ void replicate_from(TestConnections& test, int server_ind, int target_ind)
|
||||
{
|
||||
stringstream change_master;
|
||||
change_master << "CHANGE MASTER TO MASTER_HOST = '" << test.repl->IP[target_ind]
|
||||
<< "', MASTER_PORT = " << test.repl->port[target_ind] << ", MASTER_USE_GTID = current_pos, "
|
||||
"MASTER_USER='repl', MASTER_PASSWORD='repl';";
|
||||
<< "', MASTER_PORT = " << test.repl->port[target_ind] << ", MASTER_USE_GTID = current_pos, "
|
||||
"MASTER_USER='repl', MASTER_PASSWORD='repl';";
|
||||
cout << "Server " << server_ind + 1 << " starting to replicate from server " << target_ind + 1 << endl;
|
||||
if (test.verbose)
|
||||
{
|
||||
cout << "Query is '" << change_master.str() << "'" << endl;
|
||||
cout << "Query is '" << change_master.str() << "'" << endl;
|
||||
}
|
||||
test.try_query(test.repl->nodes[server_ind], "STOP SLAVE;");
|
||||
test.try_query(test.repl->nodes[server_ind], change_master.str().c_str());
|
||||
@ -65,7 +65,7 @@ void restore_servers(TestConnections& test, bool events_added)
|
||||
replicate_from(test, 2, 3);
|
||||
test.maxscales->wait_for_monitor();
|
||||
o1 = test.maxscales->ssh_node_output(0,
|
||||
"maxadmin call command mariadbmon switchover MySQL-Monitor server1 server4", true, &dummy);
|
||||
"maxadmin call command mariadbmon switchover MySQL-Monitor server1 server4", true, &dummy);
|
||||
test.maxscales->wait_for_monitor();
|
||||
int master_id = get_master_server_id(test);
|
||||
test.assert(master_id == 1, "Switchover failed to set server1 as master.");
|
||||
@ -116,8 +116,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (test.global_result != 0)
|
||||
{
|
||||
restore_servers(test, false);
|
||||
return test.global_result;
|
||||
restore_servers(test, false);
|
||||
return test.global_result;
|
||||
}
|
||||
|
||||
test.maxscales->connect_maxscale(0);
|
||||
@ -158,8 +158,8 @@ int main(int argc, char *argv[])
|
||||
check_maxscale(test);
|
||||
if (test.global_result == 0)
|
||||
{
|
||||
cout << "Test successful, restoring original state." << endl;
|
||||
restore_servers(test, true);
|
||||
cout << "Test successful, restoring original state." << endl;
|
||||
restore_servers(test, true);
|
||||
}
|
||||
return test.global_result;
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ int main(int argc, char** argv)
|
||||
test.repl->start_node(2, (char *) "");
|
||||
// Slave 3. Create a second slave connection to a non-existing server.
|
||||
const char CHANGE_CMD[] = "CHANGE MASTER 'dummy' TO MASTER_HOST = 'imagination_host.img', "
|
||||
"MASTER_PORT = 1234, MASTER_USE_GTID = current_pos, MASTER_USER='repl', MASTER_PASSWORD='repl';";
|
||||
"MASTER_PORT = 1234, MASTER_USE_GTID = current_pos, MASTER_USER='repl', MASTER_PASSWORD='repl';";
|
||||
test.try_query(nodes[3], CHANGE_CMD);
|
||||
test.try_query(nodes[3], "START SLAVE;");
|
||||
|
||||
|
@ -63,8 +63,8 @@ int main(int argc, char** argv)
|
||||
for (int i = FIRST_MOD_NODE; i < NODE_COUNT; i++)
|
||||
{
|
||||
if (mysql_query(nodes[i], STOP_SLAVE) != 0 ||
|
||||
mysql_query(nodes[i], RESET_SLAVE) != 0 ||
|
||||
mysql_query(nodes[i], READ_ONLY_OFF) != 0)
|
||||
mysql_query(nodes[i], RESET_SLAVE) != 0 ||
|
||||
mysql_query(nodes[i], READ_ONLY_OFF) != 0)
|
||||
{
|
||||
test.assert(false, "Could not stop slave connections and/or disable read_only for node %d.", i);
|
||||
return test.global_result;
|
||||
@ -114,7 +114,7 @@ int main(int argc, char** argv)
|
||||
// Finally, fix replication by telling the current master to replicate from server4
|
||||
test.tprintf("Setting server 1 to replicate from server 4. Auto-rejoin should redirect servers 2 and 3.");
|
||||
const char CHANGE_CMD_FMT[] = "CHANGE MASTER TO MASTER_HOST = '%s', MASTER_PORT = %d, "
|
||||
"MASTER_USE_GTID = current_pos, MASTER_USER='repl', MASTER_PASSWORD = 'repl';";
|
||||
"MASTER_USE_GTID = current_pos, MASTER_USER='repl', MASTER_PASSWORD = 'repl';";
|
||||
char cmd[256];
|
||||
snprintf(cmd, sizeof(cmd), CHANGE_CMD_FMT, test.repl->IP[3], test.repl->port[3]);
|
||||
mysql_query(nodes[0], cmd);
|
||||
@ -125,13 +125,13 @@ int main(int argc, char** argv)
|
||||
test.assert(master_id == 4, "Server 4 should be the cluster master.");
|
||||
StringSet node0_states = test.get_server_status("server1");
|
||||
bool states_n0_ok = (node0_states.find("Slave") != node0_states.end() &&
|
||||
node0_states.find("Relay Master") == node0_states.end());
|
||||
node0_states.find("Relay Master") == node0_states.end());
|
||||
test.assert(states_n0_ok, "Server 1 is not a slave when it should be.");
|
||||
if (states_n0_ok)
|
||||
{
|
||||
int ec;
|
||||
test.maxscales->ssh_node_output(0,
|
||||
"maxadmin call command mysqlmon switchover MySQL-Monitor server1 server4" , true, &ec);
|
||||
"maxadmin call command mysqlmon switchover MySQL-Monitor server1 server4" , true, &ec);
|
||||
test.maxscales->wait_for_monitor();
|
||||
master_id = get_master_server_id(test);
|
||||
test.assert(master_id == 1, "Server 1 should be the cluster master.");
|
||||
|
@ -93,7 +93,7 @@ int main(int argc, char** argv)
|
||||
int master_id_new = get_master_server_id(test);
|
||||
cout << "Master server id is " << master_id_new << endl;
|
||||
test.assert(master_id_new > 0 && master_id_new != master_id_old,
|
||||
"Failover did not promote a new master.");
|
||||
"Failover did not promote a new master.");
|
||||
if (test.global_result != 0)
|
||||
{
|
||||
return test.global_result;
|
||||
@ -132,7 +132,7 @@ int main(int argc, char** argv)
|
||||
cout << "Setting server " << master_id_new << " to replicate from server 1. Server " << master_id_new
|
||||
<< " should remain as the master because server 1 doesn't have the latest event it has." << endl;
|
||||
const char CHANGE_CMD_FMT[] = "CHANGE MASTER TO MASTER_HOST = '%s', MASTER_PORT = %d, "
|
||||
"MASTER_USE_GTID = current_pos, MASTER_USER='repl', MASTER_PASSWORD = 'repl';";
|
||||
"MASTER_USE_GTID = current_pos, MASTER_USER='repl', MASTER_PASSWORD = 'repl';";
|
||||
char cmd[256];
|
||||
int ind = master_id_new - 1;
|
||||
snprintf(cmd, sizeof(cmd), CHANGE_CMD_FMT, test.repl->IP[0], test.repl->port[0]);
|
||||
|
@ -59,8 +59,8 @@ int main(int argc, char** argv)
|
||||
for (int i = FIRST_MOD_NODE; i < NODE_COUNT; i++)
|
||||
{
|
||||
if (mysql_query(nodes[i], STOP_SLAVE) != 0 ||
|
||||
mysql_query(nodes[i], RESET_SLAVE) != 0 ||
|
||||
mysql_query(nodes[i], READ_ONLY_OFF) != 0)
|
||||
mysql_query(nodes[i], RESET_SLAVE) != 0 ||
|
||||
mysql_query(nodes[i], READ_ONLY_OFF) != 0)
|
||||
{
|
||||
test.assert(false, "Could not stop slave connections and/or disable read_only for node %d.", i);
|
||||
return test.global_result;
|
||||
@ -110,7 +110,7 @@ int main(int argc, char** argv)
|
||||
// Finally, fix replication by telling the current master to replicate from server4
|
||||
test.tprintf("Setting server 1 to replicate from server 4. Manually rejoin servers 2 and 3.");
|
||||
const char CHANGE_CMD_FMT[] = "CHANGE MASTER TO MASTER_HOST = '%s', MASTER_PORT = %d, "
|
||||
"MASTER_USE_GTID = current_pos, MASTER_USER='repl', MASTER_PASSWORD = 'repl';";
|
||||
"MASTER_USE_GTID = current_pos, MASTER_USER='repl', MASTER_PASSWORD = 'repl';";
|
||||
char cmd[256];
|
||||
snprintf(cmd, sizeof(cmd), CHANGE_CMD_FMT, test.repl->IP[3], test.repl->port[3]);
|
||||
mysql_query(nodes[0], cmd);
|
||||
@ -125,13 +125,13 @@ int main(int argc, char** argv)
|
||||
test.assert(master_id == 4, "Server 4 should be the cluster master.");
|
||||
StringSet node0_states = test.get_server_status("server1");
|
||||
bool states_n0_ok = (node0_states.find("Slave") != node0_states.end() &&
|
||||
node0_states.find("Relay Master") == node0_states.end());
|
||||
node0_states.find("Relay Master") == node0_states.end());
|
||||
test.assert(states_n0_ok, "Server 1 is not a slave when it should be.");
|
||||
if (states_n0_ok)
|
||||
{
|
||||
int ec;
|
||||
test.maxscales->ssh_node_output(0,
|
||||
"maxadmin call command mysqlmon switchover MySQL-Monitor server1 server4" , true, &ec);
|
||||
"maxadmin call command mysqlmon switchover MySQL-Monitor server1 server4" , true, &ec);
|
||||
test.maxscales->wait_for_monitor();
|
||||
master_id = get_master_server_id(test);
|
||||
test.assert(master_id == 1, "Server 1 should be the cluster master.");
|
||||
|
@ -23,7 +23,7 @@ void get_output(TestConnections& test)
|
||||
|
||||
test.tprintf("replication-manager output:");
|
||||
output = test.maxscales->ssh_node_f(0, true,
|
||||
"cat /var/log/replication-manager.log && sudo truncate -s 0 /var/log/replication-manager.log");
|
||||
"cat /var/log/replication-manager.log && sudo truncate -s 0 /var/log/replication-manager.log");
|
||||
test.tprintf("%s", output);
|
||||
free(output);
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ void check_conn_num(TestConnections* Test, int * Nc)
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
int conn_num = get_conn_num(Test->galera->nodes[i], Test->maxscales->IP[0], Test->maxscales->hostname[0],
|
||||
(char *) "test");
|
||||
(char *) "test");
|
||||
Test->tprintf("connections to node %d: %u (expected: %u)\n", i, conn_num, Nc[i]);
|
||||
if ((i < 4) && (Nc[i] != conn_num))
|
||||
{
|
||||
|
@ -39,7 +39,7 @@ int check_lag(int * min_lag)
|
||||
{
|
||||
sprintf(ma_cmd, "show server server%d", i + 1);
|
||||
maxscales->get_maxadmin_param(0, Test->maxscales->IP[0], (char *) "admin", Test->maxscales->maxadmin_password[0], ma_cmd,
|
||||
(char *) "Slave delay:", result);
|
||||
(char *) "Slave delay:", result);
|
||||
sscanf(result, "%d", &res_d);
|
||||
Test->tprintf("server%d lag: %d\n", i + 1, res_d);
|
||||
if (i == 1)
|
||||
@ -181,13 +181,13 @@ void *checks_thread( void *ptr )
|
||||
for (int i = 0; i < 1000; i++)
|
||||
{
|
||||
maxscales->get_maxadmin_param(0, Test->maxscales->IP[0], (char *) "admin", Test->maxscales->maxadmin_password[0],
|
||||
(char *) "show server server2", (char *) "Slave delay:", result);
|
||||
(char *) "show server server2", (char *) "Slave delay:", result);
|
||||
printf("server2: %s\n", result);
|
||||
maxscales->get_maxadmin_param(0, Test->maxscales->IP[0], (char *) "admin", Test->maxscales->maxadmin_password[0],
|
||||
(char *) "show server server3", (char *) "Slave delay:", result);
|
||||
(char *) "show server server3", (char *) "Slave delay:", result);
|
||||
printf("server3: %s\n", result);
|
||||
maxscales->get_maxadmin_param(0, Test->maxscales->IP[0], (char *) "admin", Test->maxscales->maxadmin_password[0],
|
||||
(char *) "show server server4", (char *) "Slave delay:", result);
|
||||
(char *) "show server server4", (char *) "Slave delay:", result);
|
||||
printf("server4: %s\n", result);
|
||||
}
|
||||
exit_flag = 1;
|
||||
|
@ -69,7 +69,7 @@ int check_sha1(TestConnections* Test)
|
||||
Test->tprintf("FILE: 000000%d", i);
|
||||
Test->set_timeout(50);
|
||||
s_maxscale = Test->maxscales->ssh_node_output_f(0, true, &exit_code, "sha1sum %s/mar-bin.00000%d",
|
||||
Test->maxscales->maxscale_binlog_dir, i);
|
||||
Test->maxscales->maxscale_binlog_dir, i);
|
||||
if (s_maxscale != NULL)
|
||||
{
|
||||
x = strchr(s_maxscale, ' ');
|
||||
@ -153,7 +153,7 @@ void test_binlog(TestConnections* Test)
|
||||
|
||||
Test->tprintf("SELECT * FROM t1 WHERE fl=10, checking inserted values");
|
||||
Test->add_result(execute_query_check_one(Test->repl->nodes[0], (char *) "SELECT * FROM t1 WHERE fl=10",
|
||||
"111"), "SELECT check failed");
|
||||
"111"), "SELECT check failed");
|
||||
|
||||
|
||||
Test->tprintf("ROLLBACK");
|
||||
@ -167,11 +167,11 @@ void test_binlog(TestConnections* Test)
|
||||
Test->set_timeout(20);
|
||||
Test->tprintf("SELECT * FROM t1 WHERE fl=10, checking inserted values");
|
||||
Test->add_result(execute_query_check_one(Test->repl->nodes[0], (char *) "SELECT * FROM t1 WHERE fl=10",
|
||||
"112"), "SELECT check failed");
|
||||
"112"), "SELECT check failed");
|
||||
|
||||
Test->tprintf("SELECT * FROM t1 WHERE fl=10, checking inserted values from slave");
|
||||
Test->add_result(execute_query_check_one(Test->repl->nodes[2], (char *) "SELECT * FROM t1 WHERE fl=10",
|
||||
"112"), "SELECT check failed");
|
||||
"112"), "SELECT check failed");
|
||||
Test->tprintf("DELETE FROM t1 WHERE fl=10");
|
||||
Test->try_query(Test->repl->nodes[0], (char *) "DELETE FROM t1 WHERE fl=10");
|
||||
Test->tprintf("Checking t1");
|
||||
@ -185,11 +185,11 @@ void test_binlog(TestConnections* Test)
|
||||
|
||||
Test->tprintf("SELECT, checking inserted values");
|
||||
Test->add_result(execute_query_check_one(Test->repl->nodes[0], (char *) "SELECT * FROM t1 WHERE fl=10",
|
||||
"111"), "SELECT check failed");
|
||||
"111"), "SELECT check failed");
|
||||
|
||||
Test->tprintf("SELECT, checking inserted values from slave");
|
||||
Test->add_result(execute_query_check_one(Test->repl->nodes[2], (char *) "SELECT * FROM t1 WHERE fl=10",
|
||||
"111"), "SELECT check failed");
|
||||
"111"), "SELECT check failed");
|
||||
Test->tprintf("DELETE FROM t1 WHERE fl=10");
|
||||
Test->try_query(Test->repl->nodes[0], (char *) "DELETE FROM t1 WHERE fl=10");
|
||||
|
||||
|
@ -141,19 +141,19 @@ TestConnections::TestConnections(int argc, char *argv[]):
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
{
|
||||
printf("Options:\n");
|
||||
|
||||
struct option *o = long_options;
|
||||
|
||||
while (o->name)
|
||||
{
|
||||
printf("Options:\n");
|
||||
|
||||
struct option *o = long_options;
|
||||
|
||||
while (o->name)
|
||||
{
|
||||
printf("-%c, --%s\n", o->val, o->name);
|
||||
++o;
|
||||
}
|
||||
exit(0);
|
||||
printf("-%c, --%s\n", o->val, o->name);
|
||||
++o;
|
||||
}
|
||||
break;
|
||||
exit(0);
|
||||
}
|
||||
break;
|
||||
|
||||
case 's':
|
||||
printf("Maxscale won't be started\n");
|
||||
@ -835,9 +835,9 @@ int TestConnections::prepare_binlog(int m)
|
||||
tprintf("Master server version '%s'", version_str);
|
||||
|
||||
if (*version_str &&
|
||||
strstr(version_str, "10.0") == NULL &&
|
||||
strstr(version_str, "10.1") == NULL &&
|
||||
strstr(version_str, "10.2") == NULL)
|
||||
strstr(version_str, "10.0") == NULL &&
|
||||
strstr(version_str, "10.1") == NULL &&
|
||||
strstr(version_str, "10.2") == NULL)
|
||||
{
|
||||
add_result(maxscales->ssh_node_f(m, true,
|
||||
"sed -i \"s/,mariadb10-compatibility=1//\" %s",
|
||||
@ -1061,8 +1061,8 @@ bool TestConnections::replicate_from_master(int m)
|
||||
conn = open_conn_no_db(maxscales->binlog_port[m], maxscales->IP[m], repl->user_name, repl->password, ssl);
|
||||
|
||||
if (find_field(repl->nodes[0], "show master status", "File", log_file) ||
|
||||
repl->set_slave(conn, repl->IP[0], repl->port[0], log_file, log_pos) ||
|
||||
execute_query(conn, "start slave"))
|
||||
repl->set_slave(conn, repl->IP[0], repl->port[0], log_file, log_pos) ||
|
||||
execute_query(conn, "start slave"))
|
||||
{
|
||||
rval = false;
|
||||
}
|
||||
@ -1303,7 +1303,7 @@ int TestConnections::check_maxscale_processes(int m, int expected)
|
||||
{
|
||||
int exit_code;
|
||||
char* maxscale_num = maxscales->ssh_node_output(m, "ps -C maxscale | grep maxscale | wc -l", false,
|
||||
&exit_code);
|
||||
&exit_code);
|
||||
if ((maxscale_num == NULL) || (exit_code != 0))
|
||||
{
|
||||
return -1;
|
||||
|
Reference in New Issue
Block a user