MXS-2900 Run uncrustify on testconnections.cpp

Also some other minor cleanup.
This commit is contained in:
Esa Korhonen
2020-04-01 17:46:10 +03:00
parent 5ed99b2f5b
commit 071501ea1f

View File

@ -288,7 +288,6 @@ TestConnections::TestConnections(int argc, char* argv[])
{ {
exit(MDBCI_FAIL); exit(MDBCI_FAIL);
} }
} }
if (m_required_mdbci_labels.count(label_repl_be) == 0) if (m_required_mdbci_labels.count(label_repl_be) == 0)
@ -746,7 +745,11 @@ void TestConnections::process_template(int m, const string& cnf_template_path, c
if (backend_ssl) if (backend_ssl)
{ {
tprintf("Adding ssl settings\n"); tprintf("Adding ssl settings\n");
system("sed -i \"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\" maxscale.cnf"); const char sed_cmd[] = "sed -i "
"\"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\" maxscale.cnf";
system(sed_cmd);
} }
sprintf(str, "sed -i \"s/###threads###/%d/\" maxscale.cnf", m_threads); sprintf(str, "sed -i \"s/###threads###/%d/\" maxscale.cnf", m_threads);
@ -782,9 +785,13 @@ void TestConnections::process_template(int m, const string& cnf_template_path, c
system(str); system(str);
} }
sprintf(str, "sed -i \"s/###%s###/%s/\" maxscale.cnf", mdn[j]->cnf_server_name.c_str(), mdn[j]->cnf_servers().c_str()); sprintf(str,
"sed -i \"s/###%s###/%s/\" maxscale.cnf",
mdn[j]->cnf_server_name.c_str(), mdn[j]->cnf_servers().c_str());
system(str); system(str);
sprintf(str, "sed -i \"s/###%s_line###/%s/\" maxscale.cnf", mdn[j]->cnf_server_name.c_str(), mdn[j]->cnf_servers_line().c_str()); sprintf(str,
"sed -i \"s/###%s_line###/%s/\" maxscale.cnf",
mdn[j]->cnf_server_name.c_str(), mdn[j]->cnf_servers_line().c_str());
system(str); system(str);
mdn[j]->connect(); mdn[j]->connect();
@ -1230,7 +1237,8 @@ int TestConnections::start_binlog(int m)
for (i = 2; i < repl->N; i++) for (i = 2; i < repl->N; i++)
{ {
try_query(repl->nodes[i], "stop slave"); try_query(repl->nodes[i], "stop slave");
repl->set_slave(repl->nodes[i], maxscales->IP_private[m], maxscales->binlog_port[m], log_file, log_pos); repl->set_slave(repl->nodes[i], maxscales->IP_private[m], maxscales->binlog_port[m],
log_file, log_pos);
} }
} }
@ -2174,26 +2182,22 @@ int TestConnections::call_mdbci(const char * options)
tprintf("Failed to generate MDBCI virtual machines template"); tprintf("Failed to generate MDBCI virtual machines template");
return 1; return 1;
} }
if (system((std::string("mdbci --override --template ") + m_vm_path + if (system((std::string("mdbci --override --template ") + m_vm_path
".json generate " + m_mdbci_config_name).c_str() )) + ".json generate " + m_mdbci_config_name).c_str()))
{ {
tprintf("MDBCI failed to generate virtual machines description"); tprintf("MDBCI failed to generate virtual machines description");
return 1; return 1;
} }
if (system((std::string("cp -r ") + test_dir + std::string("/mdbci/cnf ") + if (system((std::string("cp -r ") + test_dir + std::string("/mdbci/cnf ")
m_vm_path + "/").c_str())) + m_vm_path + "/").c_str()))
{ {
tprintf("Failed to copy my.cnf files"); tprintf("Failed to copy my.cnf files");
return 1; return 1;
} }
} }
if (system((std::string("mdbci up ") + if (system((std::string("mdbci up ") + m_mdbci_config_name + " --labels " + m_mdbci_labels_str + " "
m_mdbci_config_name + + options).c_str()))
std::string(" --labels ") +
m_mdbci_labels_str +
std::string(" ") +
std::string(options)).c_str() ))
{ {
tprintf("MDBCI failed to bring up virtual machines"); tprintf("MDBCI failed to bring up virtual machines");
return 1; return 1;