Format all files

Formatted all files with uncrustify.
This commit is contained in:
Markus Mäkelä
2018-10-29 14:06:58 +02:00
parent 8d1b26060a
commit 906d8cee5b
9 changed files with 46 additions and 40 deletions

View File

@ -43,7 +43,7 @@ int check_conf(TestConnections& test, int blocked_node)
for (int i = 0; i < 2; i++)
{
if ( i != blocked_node)
if (i != blocked_node)
{
test.tprintf("Checking data from node %d (%s)\n", i, test.repl->IP[i]);
test.set_timeout(100);
@ -63,7 +63,7 @@ int check_conf(TestConnections& test, int blocked_node)
return global_result;
}
int main(int argc, char *argv[])
int main(int argc, char* argv[])
{
TestConnections test(argc, argv);
@ -75,16 +75,16 @@ int main(int argc, char *argv[])
test.start_mm(0); // first node - slave, second - master
test.set_timeout(120);
test.maxscales->get_maxadmin_param(0, (char *) "show server server1", (char *) "Status:", maxadmin_result);
test.maxscales->get_maxadmin_param(0, (char*) "show server server1", (char*) "Status:", maxadmin_result);
test.tprintf("node0 %s\n", maxadmin_result);
if (strstr(maxadmin_result, "Slave, Running") == NULL )
if (strstr(maxadmin_result, "Slave, Running") == NULL)
{
test.add_result(1, "Node0 is not slave, status is %s\n", maxadmin_result);
}
test.set_timeout(120);
test.maxscales->get_maxadmin_param(0, (char *) "show server server2", (char *) "Status:", maxadmin_result);
test.maxscales->get_maxadmin_param(0, (char*) "show server server2", (char*) "Status:", maxadmin_result);
test.tprintf("node1 %s\n", maxadmin_result);
if (strstr(maxadmin_result, "Master, Running") == NULL )
if (strstr(maxadmin_result, "Master, Running") == NULL)
{
test.add_result(1, "Node1 is not master, status is %s\n", maxadmin_result);
}
@ -97,9 +97,9 @@ int main(int argc, char *argv[])
test.stop_timeout();
test.maxscales->wait_for_monitor();
test.set_timeout(120);
test.maxscales->get_maxadmin_param(0, (char *) "show server server1", (char *) "Status:", maxadmin_result);
test.maxscales->get_maxadmin_param(0, (char*) "show server server1", (char*) "Status:", maxadmin_result);
printf("node0 %s\n", maxadmin_result);
if (strstr(maxadmin_result, "Down") == NULL )
if (strstr(maxadmin_result, "Down") == NULL)
{
test.add_result(1, "Node0 is not down, status is %s\n", maxadmin_result);
}
@ -116,9 +116,9 @@ int main(int argc, char *argv[])
test.tprintf("Block master\n");
test.repl->block_node(1);
test.maxscales->wait_for_monitor();
test.maxscales->get_maxadmin_param(0, (char *) "show server server2", (char *) "Status:", maxadmin_result);
test.maxscales->get_maxadmin_param(0, (char*) "show server server2", (char*) "Status:", maxadmin_result);
printf("node1 %s\n", maxadmin_result);
if (strstr(maxadmin_result, "Down") == NULL )
if (strstr(maxadmin_result, "Down") == NULL)
{
test.add_result(1, "Node1 is not down, status is %s\n", maxadmin_result);
}
@ -126,7 +126,7 @@ int main(int argc, char *argv[])
test.set_timeout(120);
test.repl->connect();
execute_query(test.repl->nodes[0], (char *) "SET GLOBAL READ_ONLY=OFF");
execute_query(test.repl->nodes[0], (char*) "SET GLOBAL READ_ONLY=OFF");
test.repl->close_connections();
test.maxscales->wait_for_monitor();
@ -141,7 +141,7 @@ int main(int argc, char *argv[])
test.set_timeout(120);
printf("Make node 2 slave\n");
test.repl->connect();
execute_query(test.repl->nodes[1], (char *) "SET GLOBAL READ_ONLY=ON");
execute_query(test.repl->nodes[1], (char*) "SET GLOBAL READ_ONLY=ON");
test.repl->close_connections();
test.maxscales->wait_for_monitor();
@ -150,16 +150,16 @@ int main(int argc, char *argv[])
test.add_result(check_conf(test, 2), "Configuration broken\n");
test.set_timeout(60);
test.maxscales->get_maxadmin_param(0, (char *) "show server server2", (char *) "Status:", maxadmin_result);
test.maxscales->get_maxadmin_param(0, (char*) "show server server2", (char*) "Status:", maxadmin_result);
printf("node1 %s\n", maxadmin_result);
if (strstr(maxadmin_result, "Slave, Running") == NULL )
if (strstr(maxadmin_result, "Slave, Running") == NULL)
{
test.add_result(1, "Node1 is not slave, status is %s\n", maxadmin_result);
}
test.set_timeout(60);
test.maxscales->get_maxadmin_param(0, (char *) "show server server1", (char *) "Status:", maxadmin_result);
test.maxscales->get_maxadmin_param(0, (char*) "show server server1", (char*) "Status:", maxadmin_result);
test.tprintf("node0 %s\n", maxadmin_result);
if (strstr(maxadmin_result, "Master, Running") == NULL )
if (strstr(maxadmin_result, "Master, Running") == NULL)
{
test.add_result(1, "Node0 is not master, status is %s\n", maxadmin_result);
}

View File

@ -334,7 +334,7 @@ void restore_server_ids(TestConnections& test, const map<int, string>& server_id
{
for_each(server_ids_by_index.begin(),
server_ids_by_index.end(),
[&test] (const pair<int, string>& server_id_by_index) {
[&test](const pair<int, string>& server_id_by_index) {
test.try_query(test.galera->nodes[server_id_by_index.first],
"set GLOBAL server_id=%s", server_id_by_index.second.c_str());
});
@ -345,7 +345,7 @@ void restart_slave(TestConnections& test, MYSQL* pSlave)
{
Row row;
auto replication_failed = [] (const std::string& column) {
auto replication_failed = [](const std::string& column) {
return column.find("Got fatal error") != string::npos;
};
@ -404,7 +404,6 @@ bool test_multiple_masters(TestConnections& test, MYSQL* pSlave)
return test.global_result == 0;
}
}
int main(int argc, char* argv[])
@ -441,7 +440,7 @@ int main(int argc, char* argv[])
if (setup_server_ids(test, &server_ids_by_index))
{
for (Approach approach : { Approach::GTID, Approach::FILE_POS } )
for (Approach approach : {Approach::GTID, Approach::FILE_POS})
{
inserted_rows = 0;

View File

@ -21,7 +21,8 @@ int main(int argc, char** argv)
test.maxscales->connect();
Row server1 = get_row(test.maxscales->conn_rwsplit[0], "SELECT @@server_id, @@last_insert_id, id FROM test.t1");
Row server1 = get_row(test.maxscales->conn_rwsplit[0],
"SELECT @@server_id, @@last_insert_id, id FROM test.t1");
Row server2 = get_row(test.maxscales->conn_rwsplit[0], "SELECT @@server_id, id FROM test.t2");
Row server3 = get_row(test.maxscales->conn_rwsplit[0], "SELECT @@server_id, id FROM test.t3");
Row server4 = get_row(test.maxscales->conn_rwsplit[0], "SELECT @@server_id, id FROM test.t4");
@ -29,10 +30,14 @@ int main(int argc, char** argv)
test.maxscales->disconnect();
test.repl->connect();
test.expect(server1[0] == test.repl->get_server_id_str(0), "First query without hint should go to server1, the master");
test.expect(server2[0] == test.repl->get_server_id_str(1), "Second query without hint should go to server2, the slave");
test.expect(server3[0] == test.repl->get_server_id_str(2), "First query with hint should go to server3, the first unmonitored server");
test.expect(server4[0] == test.repl->get_server_id_str(3), "Second query with hint should go to server4, the second unmonitored server");
test.expect(server1[0] == test.repl->get_server_id_str(0),
"First query without hint should go to server1, the master");
test.expect(server2[0] == test.repl->get_server_id_str(1),
"Second query without hint should go to server2, the slave");
test.expect(server3[0] == test.repl->get_server_id_str(2),
"First query with hint should go to server3, the first unmonitored server");
test.expect(server4[0] == test.repl->get_server_id_str(3),
"Second query with hint should go to server4, the second unmonitored server");
test.repl->disconnect();
return test.global_result;

View File

@ -626,7 +626,9 @@ void TestConnections::process_template(int m, const char* template_name, const c
if (backend_ssl)
{
ss << " -e \"s|type=server|type=server\\nssl=required\\nssl_cert=/###access_homedir###/certs/client-cert.pem\\nssl_key=/###access_homedir###/certs/client-key.pem\\nssl_ca_cert=/###access_homedir###/certs/ca.pem|g\" ";
ss
<<
" -e \"s|type=server|type=server\\nssl=required\\nssl_cert=/###access_homedir###/certs/client-cert.pem\\nssl_key=/###access_homedir###/certs/client-key.pem\\nssl_ca_cert=/###access_homedir###/certs/ca.pem|g\" ";
}
ss << " -e \"s/###threads###/" << threads << "/\" ";

View File

@ -93,7 +93,7 @@ Service* service_alloc(const char* name, const char* router, MXS_CONFIG_PARAMETE
return NULL;
}
Service* service = new( std::nothrow) Service(name, router, params);
Service* service = new(std::nothrow) Service(name, router, params);
if (service == nullptr)
{