Merge test changes from 2.3
This commit is contained in:
commit
a2eafc2381
@ -183,10 +183,10 @@ int main(int argc, char* argv[])
|
||||
Test->set_timeout(60);
|
||||
num_conn =
|
||||
get_conn_num(Test->repl->nodes[i],
|
||||
Test->maxscales->IP[0],
|
||||
Test->maxscales->IP_private[0],
|
||||
Test->maxscales->hostname[0],
|
||||
(char*) "test");
|
||||
Test->tprintf("Connections to node %d (%s): %d\n", i, Test->repl->IP[i], num_conn);
|
||||
Test->tprintf("Connections to node %d (%s): %d\n", i, Test->repl->IP_private[i], num_conn);
|
||||
if ((i == 0) && (num_conn > 2 * conn_N))
|
||||
{
|
||||
Test->add_result(1, "too many connections to master\n");
|
||||
@ -205,10 +205,10 @@ int main(int argc, char* argv[])
|
||||
Test->set_timeout(60);
|
||||
num_conn =
|
||||
get_conn_num(Test->repl->nodes[i],
|
||||
Test->maxscales->IP[0],
|
||||
Test->maxscales->IP_private[0],
|
||||
Test->maxscales->hostname[0],
|
||||
(char*) "test");
|
||||
printf("Connections to node %d (%s): %d\n", i, Test->repl->IP[i], num_conn);
|
||||
printf("Connections to node %d (%s): %d\n", i, Test->repl->IP_private[i], num_conn);
|
||||
if ((i == 0) && (num_conn > 2 * conn_N))
|
||||
{
|
||||
Test->add_result(1, "too many connections to master\n");
|
||||
@ -223,10 +223,10 @@ int main(int argc, char* argv[])
|
||||
{
|
||||
num_conn =
|
||||
get_conn_num(Test->repl->nodes[i],
|
||||
Test->maxscales->IP[0],
|
||||
Test->maxscales->IP_private[0],
|
||||
Test->maxscales->hostname[0],
|
||||
(char*) "test");
|
||||
printf("Connections to node %d (%s): %d\n", i, Test->repl->IP[i], num_conn);
|
||||
printf("Connections to node %d (%s): %d\n", i, Test->repl->IP_private[i], num_conn);
|
||||
if ((i == 0) && (num_conn > 2 * conn_N))
|
||||
{
|
||||
Test->add_result(1, "too many connections to master\n");
|
||||
@ -242,10 +242,10 @@ int main(int argc, char* argv[])
|
||||
Test->set_timeout(60);
|
||||
num_conn =
|
||||
get_conn_num(Test->repl->nodes[i],
|
||||
Test->maxscales->IP[0],
|
||||
Test->maxscales->IP_private[0],
|
||||
Test->maxscales->hostname[0],
|
||||
(char*) "test");
|
||||
printf("Connections to node %d (%s): %d\n", i, Test->repl->IP[i], num_conn);
|
||||
printf("Connections to node %d (%s): %d\n", i, Test->repl->IP_private[i], num_conn);
|
||||
if ((i == 0) && (num_conn != 0))
|
||||
{
|
||||
Test->add_result(1, "there are still connections to master\n");
|
||||
@ -263,10 +263,10 @@ int main(int argc, char* argv[])
|
||||
Test->set_timeout(60);
|
||||
num_conn =
|
||||
get_conn_num(Test->repl->nodes[i],
|
||||
Test->maxscales->IP[0],
|
||||
Test->maxscales->IP_private[0],
|
||||
Test->maxscales->hostname[0],
|
||||
(char*) "test");
|
||||
Test->tprintf("Connections to node %d (%s): %d\n", i, Test->repl->IP[i], num_conn);
|
||||
Test->tprintf("Connections to node %d (%s): %d\n", i, Test->repl->IP_private[i], num_conn);
|
||||
if ((i == 0) && (num_conn != 0))
|
||||
{
|
||||
Test->add_result(1, "there are still connections to master\n");
|
||||
@ -288,10 +288,10 @@ int main(int argc, char* argv[])
|
||||
Test->set_timeout(60);
|
||||
num_conn =
|
||||
get_conn_num(Test->repl->nodes[i],
|
||||
Test->maxscales->IP[0],
|
||||
Test->maxscales->IP_private[0],
|
||||
Test->maxscales->hostname[0],
|
||||
(char*) "test");
|
||||
Test->tprintf("Connections to node %d (%s): %d\n", i, Test->repl->IP[i], num_conn);
|
||||
Test->tprintf("Connections to node %d (%s): %d\n", i, Test->repl->IP_private[i], num_conn);
|
||||
if ((i == 0) && (num_conn != 0))
|
||||
{
|
||||
Test->add_result(1, "there are still connections to master\n");
|
||||
@ -311,10 +311,10 @@ int main(int argc, char* argv[])
|
||||
Test->set_timeout(60);
|
||||
num_conn =
|
||||
get_conn_num(Test->repl->nodes[i],
|
||||
Test->maxscales->IP[0],
|
||||
Test->maxscales->IP_private[0],
|
||||
Test->maxscales->hostname[0],
|
||||
(char*) "test");
|
||||
Test->tprintf("Connections to node %d (%s): %d\n", i, Test->repl->IP[i], num_conn);
|
||||
Test->tprintf("Connections to node %d (%s): %d\n", i, Test->repl->IP_private[i], num_conn);
|
||||
if ((i == 0) && (num_conn != 0))
|
||||
{
|
||||
Test->add_result(1, "there are still connections to master\n");
|
||||
|
@ -20,7 +20,7 @@ monitor_interval=1000
|
||||
[Masking]
|
||||
type=filter
|
||||
module=masking
|
||||
rules=/home/vagrant/masking_auto_firewall.json
|
||||
rules=/###access_homedir###/masking_auto_firewall.json
|
||||
warn_type_mismatch=always
|
||||
large_payload=ignore
|
||||
treat_string_arg_as_field=false
|
||||
|
@ -20,7 +20,7 @@ monitor_interval=1000
|
||||
[Masking]
|
||||
type=filter
|
||||
module=masking
|
||||
rules=/home/vagrant/mxs1719.json
|
||||
rules=/###access_homedir###/mxs1719.json
|
||||
warn_type_mismatch=always
|
||||
large_payload=ignore
|
||||
require_fully_parsed=false
|
||||
|
@ -27,7 +27,7 @@ port = 4006
|
||||
[lua]
|
||||
type = filter
|
||||
module = luafilter
|
||||
session_script=/home/vagrant/infinite_loop.lua
|
||||
session_script=/###access_homedir###/infinite_loop.lua
|
||||
|
||||
[MaxAdmin-Service]
|
||||
type = service
|
||||
|
@ -96,7 +96,7 @@ void Config::create_server(int num)
|
||||
true,
|
||||
"maxctrl create server server%d %s %d %s",
|
||||
num,
|
||||
test_->repl->IP[num],
|
||||
test_->repl->IP_private[num],
|
||||
test_->repl->port[num],
|
||||
ssl_line);
|
||||
created_servers_.insert(num);
|
||||
|
@ -6,6 +6,16 @@ void copy_rules(TestConnections* Test, const char* rules_name, const char* rules
|
||||
std::stringstream src;
|
||||
std::stringstream dest;
|
||||
|
||||
Test->maxscales->ssh_node_f(0,
|
||||
true,
|
||||
"cd %s;"
|
||||
"rm -rf rules;"
|
||||
"mkdir rules;"
|
||||
"chown %s:%s rules",
|
||||
Test->maxscales->access_homedir[0],
|
||||
Test->maxscales->access_user[0],
|
||||
Test->maxscales->access_user[0]);
|
||||
|
||||
src << rules_dir << "/" << rules_name;
|
||||
dest << Test->maxscales->access_homedir[0] << "/rules/rules.txt";
|
||||
|
||||
|
@ -35,14 +35,6 @@ int main(int argc, char* argv[])
|
||||
char rules_dir[4096];
|
||||
FILE* file;
|
||||
|
||||
Test->maxscales->ssh_node_f(0,
|
||||
true,
|
||||
"cd %s;"
|
||||
"rm -rf rules;"
|
||||
"mkdir rules;"
|
||||
"chown vagrant:vagrant rules",
|
||||
Test->maxscales->access_homedir[0]);
|
||||
|
||||
sprintf(rules_dir, "%s/fw/", test_dir);
|
||||
int N = 19;
|
||||
int i;
|
||||
|
@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include "testconnections.h"
|
||||
#include "fw_copy_rules.h"
|
||||
|
||||
const char* rules = "rule test1 deny regex '.*'\n"
|
||||
"users %@% match any rules test1\n";
|
||||
@ -19,11 +20,7 @@ int main(int argc, char** argv)
|
||||
TestConnections::skip_maxscale_start(true);
|
||||
TestConnections test(argc, argv);
|
||||
|
||||
test.maxscales->ssh_node(0,
|
||||
"mkdir -p /home/vagrant/rules/; chown -R vagrant:vagrant /home/vagrant/rules/",
|
||||
true);
|
||||
test.maxscales->copy_to_node_legacy((char*)"rules.txt", (char*)"~/rules/rules.txt", 0);
|
||||
test.maxscales->ssh_node(0, "chmod a+r /home/vagrant/rules/rules.txt;", true);
|
||||
copy_rules(&test, (char*) "rules.txt", (char*) ".");
|
||||
|
||||
test.maxscales->restart_maxscale(0);
|
||||
test.maxscales->connect_maxscale(0);
|
||||
|
@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include "testconnections.h"
|
||||
#include "fw_copy_rules.h"
|
||||
|
||||
const char* rules = "rule test1 deny no_where_clause\n"
|
||||
"rule test1 deny columns a b c\n"
|
||||
@ -20,11 +21,7 @@ int main(int argc, char** argv)
|
||||
TestConnections::skip_maxscale_start(true);
|
||||
TestConnections test(argc, argv);
|
||||
|
||||
test.maxscales->ssh_node(0,
|
||||
"mkdir -p /home/vagrant/rules/; chown -R vagrant:vagrant /home/vagrant/rules/",
|
||||
true);
|
||||
test.maxscales->copy_to_node_legacy((char*)"rules.txt", (char*)"~/rules/rules.txt", 0);
|
||||
test.maxscales->ssh_node(0, "chmod a+r /home/vagrant/rules/rules.txt;", true);
|
||||
copy_rules(&test, (char*) "rules.txt", (char*) ".");
|
||||
|
||||
int rc = 0;
|
||||
|
||||
|
@ -6,17 +6,21 @@
|
||||
*/
|
||||
|
||||
#include "testconnections.h"
|
||||
#include "fw_copy_rules.h"
|
||||
|
||||
const char* rules = "rule test1 deny columns c on_queries select\n"
|
||||
"users %@% match any rules test1\n";
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
FILE* file = fopen("rules.txt", "w");
|
||||
fwrite(rules, 1, strlen(rules), file);
|
||||
fclose(file);
|
||||
|
||||
TestConnections::skip_maxscale_start(true);
|
||||
TestConnections test(argc, argv);
|
||||
test.maxscales->ssh_node_f(0,
|
||||
true,
|
||||
"mkdir -p /home/vagrant/rules/;"
|
||||
"echo 'rule test1 deny columns c on_queries select' > /home/vagrant/rules/rules.txt;"
|
||||
"echo 'users %%@%% match any rules test1' >> /home/vagrant/rules/rules.txt;"
|
||||
"chmod a+r /home/vagrant/rules/rules.txt;");
|
||||
|
||||
copy_rules(&test, (char*) "rules.txt", (char*) ".");
|
||||
|
||||
test.add_result(test.maxscales->restart_maxscale(0), "Restarting MaxScale failed");
|
||||
|
||||
|
@ -71,5 +71,6 @@ void stop_keepalived(TestConnections* Test)
|
||||
for (int i = 0; i < Test->maxscales->N; i++)
|
||||
{
|
||||
Test->maxscales->ssh_node(i, "sudo service keepalived stop", true);
|
||||
Test->maxscales->ssh_node(i, "killall -9 keepalived", true);
|
||||
}
|
||||
}
|
||||
|
@ -474,7 +474,7 @@ int get_conn_num(MYSQL* conn, std::string ip, std::string hostname, std::string
|
||||
row = mysql_fetch_row(res);
|
||||
if ((row[2] != NULL ) && (row[3] != NULL))
|
||||
{
|
||||
if (strstr(row[2], ip.c_str()) && strstr(row[3], db.c_str()))
|
||||
if ((strcmp(strtok(row[2], ":"), ip.c_str()) == 0) && strstr(row[3], db.c_str()))
|
||||
{
|
||||
conn_num++;
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ int Mariadb_nodes::find_master()
|
||||
i = 0;
|
||||
while ((found == 0) && (i < N))
|
||||
{
|
||||
if (strcmp(IP[i], master_IP) == 0)
|
||||
if (strcmp(IP_private[i], master_IP) == 0)
|
||||
{
|
||||
found = 1;
|
||||
master_node = i;
|
||||
@ -273,7 +273,7 @@ void Mariadb_nodes::change_master(int NewMaster, int OldMaster)
|
||||
if (i != NewMaster && mysql_ping(nodes[i]) == 0)
|
||||
{
|
||||
char str[1024];
|
||||
sprintf(str, setup_slave, IP[NewMaster], log_file, log_pos, port[NewMaster]);
|
||||
sprintf(str, setup_slave, IP_private[NewMaster], log_file, log_pos, port[NewMaster]);
|
||||
execute_query(nodes[i], "%s", str);
|
||||
}
|
||||
}
|
||||
@ -445,7 +445,7 @@ int Galera_nodes::start_galera()
|
||||
true,
|
||||
"sed -i 's/###NODE-ADDRESS###/%s/' /etc/my.cnf.d/* /etc/mysql/my.cnf.d/*;"
|
||||
"sed -i \"s|###GALERA-LIB-PATH###|$(ls /usr/lib*/galera/*.so)|g\" /etc/my.cnf.d/* /etc/mysql/my.cnf.d/*",
|
||||
IP[i]);
|
||||
IP_private[i]);
|
||||
}
|
||||
|
||||
printf("Starting new Galera cluster\n");
|
||||
@ -1493,12 +1493,13 @@ int Mariadb_nodes::prepare_servers()
|
||||
|
||||
void Mariadb_nodes::replicate_from(int slave, int master, const char* type)
|
||||
{
|
||||
replicate_from(slave, IP[master], port[master], type);
|
||||
replicate_from(slave, IP_private[master], port[master], type);
|
||||
}
|
||||
|
||||
void Mariadb_nodes::replicate_from(int slave, const std::string& host, uint16_t port, const char* type)
|
||||
{
|
||||
std::stringstream change_master;
|
||||
|
||||
change_master << "CHANGE MASTER TO MASTER_HOST = '" << host
|
||||
<< "', MASTER_PORT = " << port << ", MASTER_USE_GTID = "
|
||||
<< type << ", MASTER_USER='repl', MASTER_PASSWORD='repl';";
|
||||
@ -1535,7 +1536,7 @@ std::string Mariadb_nodes::cnf_servers()
|
||||
cnf_server_name +
|
||||
std::to_string(i + 1) +
|
||||
std::string("]\\ntype=server\\naddress=") +
|
||||
std::string(IP[i]) +
|
||||
std::string(IP_private[i]) +
|
||||
std::string("\\nport=") +
|
||||
std::to_string(port[i]) +
|
||||
std::string("\\nprotocol=MySQLBackend\\n");
|
||||
|
@ -173,7 +173,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
std::string json_file("/masking_auto_firewall.json");
|
||||
std::string from = test_dir + json_file;
|
||||
std::string to = "/home/vagrant" + json_file;
|
||||
std::string to = std::string(test.maxscales->access_homedir[0]) + json_file;
|
||||
|
||||
if (test.maxscales->copy_to_node(0, from.c_str(), to.c_str()) == 0)
|
||||
{
|
||||
|
@ -207,7 +207,7 @@ int compare_expected(TestConnections* Test, const char* sql, my_ulonglong exp_i,
|
||||
my_ulonglong* rows = new my_ulonglong[30];
|
||||
my_ulonglong i;
|
||||
|
||||
Test->set_timeout(30);
|
||||
Test->set_timeout(90);
|
||||
execute_query_num_of_rows(Test->maxscales->conn_rwsplit[0], sql, rows, &i);
|
||||
|
||||
Test->tprintf("Result sets number is %llu\n", i);
|
||||
@ -252,7 +252,7 @@ int compare_stmt_expected(TestConnections* Test,
|
||||
my_ulonglong* rows = new my_ulonglong[30];
|
||||
my_ulonglong i;
|
||||
|
||||
Test->set_timeout(30);
|
||||
Test->set_timeout(90);
|
||||
execute_stmt_num_of_rows(stmt, rows, &i);
|
||||
|
||||
Test->tprintf("Result sets number is %llu\n", i);
|
||||
|
@ -27,13 +27,6 @@ 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]);
|
||||
copy_rules(Test, "rules2", fw_rules.c_str());
|
||||
|
||||
Test->maxscales->start_maxscale(0);
|
||||
|
@ -24,7 +24,7 @@ void change_master(TestConnections& test, int slave, int master, const char* nam
|
||||
"CHANGE MASTER %s TO master_host='%s', master_port=3306, master_user='%s', master_password='%s', master_use_gtid=slave_pos;"
|
||||
"START ALL SLAVES",
|
||||
source.c_str(),
|
||||
test.repl->IP[master],
|
||||
test.repl->IP_private[master],
|
||||
test.repl->user_name,
|
||||
test.repl->password);
|
||||
}
|
||||
|
@ -78,8 +78,9 @@ int main(int argc, char* argv[])
|
||||
TestConnections test(argc, argv);
|
||||
std::string src = test_dir;
|
||||
src += "/mxs1719.json";
|
||||
std::string dst = std::string(test.maxscales->access_homedir[0]) + "/mxs1719.json";
|
||||
|
||||
if (test.maxscales->copy_to_node(0, src.c_str(), "/home/vagrant/mxs1719.json") == 0)
|
||||
if (test.maxscales->copy_to_node(0, src.c_str(), dst.c_str()) == 0)
|
||||
{
|
||||
if (test.maxscales->start() == 0)
|
||||
{
|
||||
|
@ -13,6 +13,8 @@
|
||||
|
||||
DEFINE_EXCEPTION(Whoopsy);
|
||||
|
||||
constexpr int TIMEOUT = 300;
|
||||
|
||||
// TODO these should be read from maxscale.cnf. Maybe the test-lib should replace
|
||||
// any "###ENV_VAR###", with environment variables so that code and conf can share.
|
||||
constexpr int max_qps = 500;
|
||||
@ -196,26 +198,26 @@ int main(int argc, char* argv[])
|
||||
test.maxscales->connect_maxscale(0);
|
||||
|
||||
std::cout << "Create table\n";
|
||||
test.set_timeout(120);
|
||||
test.set_timeout(TIMEOUT);
|
||||
create_table(test.maxscales->conn_master[0]);
|
||||
|
||||
std::cout << "Insert rows\n";
|
||||
test.set_timeout(120);
|
||||
test.set_timeout(TIMEOUT);
|
||||
insert_rows(test.maxscales->conn_master[0]);
|
||||
|
||||
test.set_timeout(120);
|
||||
test.set_timeout(TIMEOUT);
|
||||
gauge_raw_speed(test);
|
||||
|
||||
test.stop_timeout();
|
||||
test.repl->sync_slaves();
|
||||
|
||||
test.set_timeout(120);
|
||||
test.set_timeout(TIMEOUT);
|
||||
verify_throttling_performace(test);
|
||||
|
||||
test.maxscales->close_maxscale_connections(0);
|
||||
test.maxscales->connect_maxscale(0);
|
||||
|
||||
test.set_timeout(120);
|
||||
test.set_timeout(TIMEOUT);
|
||||
verify_throttling_disconnect(test);
|
||||
|
||||
std::cout << "\n\n";
|
||||
|
@ -78,7 +78,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
std::string lua_file("/infinite_loop.lua");
|
||||
std::string from = test_dir + lua_file;
|
||||
std::string to = "/home/vagrant" + lua_file;
|
||||
std::string to = std::string(test.maxscales->access_homedir[0]) + lua_file;
|
||||
|
||||
test.maxscales->copy_to_node(0, from.c_str(), to.c_str());
|
||||
test.maxscales->start();
|
||||
|
@ -77,7 +77,7 @@ int main(int argc, char* argv[])
|
||||
true,
|
||||
"maxadmin create server server%d 3306 %s",
|
||||
i + 1,
|
||||
test->repl->IP[i]);
|
||||
test->repl->IP_private[i]);
|
||||
}
|
||||
|
||||
/** Add the servers to the monitor and service */
|
||||
@ -96,7 +96,7 @@ int main(int argc, char* argv[])
|
||||
true,
|
||||
"maxadmin create server server%d %s %d",
|
||||
i + 1,
|
||||
test->repl->IP[i],
|
||||
test->repl->IP_private[i],
|
||||
test->repl->port[i]);
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
config.create_server(1);
|
||||
config.add_server(1);
|
||||
config.alter_server(1, "address", test->repl->IP[1]);
|
||||
config.alter_server(1, "address", test->repl->IP_private[1]);
|
||||
sleep(1);
|
||||
test->check_maxscale_alive(0);
|
||||
config.alter_server(1, "address", "This-is-not-the-address-you-are-looking-for");
|
||||
|
@ -32,7 +32,7 @@ void check_maxscale(TestConnections& test)
|
||||
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]
|
||||
change_master << "CHANGE MASTER TO MASTER_HOST = '" << test.repl->IP_private[target_ind]
|
||||
<< "', 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;
|
||||
|
@ -172,7 +172,7 @@ void change_master(TestConnections& test ,int slave, int master, const string& c
|
||||
"master_user='repl', master_password='repl', master_delay=%d; "
|
||||
"START SLAVE '%s';";
|
||||
test.try_query(test.repl->nodes[slave], query, conn_name.c_str(),
|
||||
test.repl->IP[master], test.repl->port[master],
|
||||
test.repl->IP_private[master], test.repl->port[master],
|
||||
replication_delay, conn_name.c_str());
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ int main(int argc, char** argv)
|
||||
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';";
|
||||
char change_cmd[256];
|
||||
snprintf(change_cmd, sizeof(change_cmd), CHANGE_CMD_FMT, test.repl->IP[3], test.repl->port[3]);
|
||||
snprintf(change_cmd, sizeof(change_cmd), CHANGE_CMD_FMT, test.repl->IP_private[3], test.repl->port[3]);
|
||||
test.try_query(nodes[0], "%s", change_cmd);
|
||||
test.try_query(nodes[0], "START SLAVE;");
|
||||
test.maxscales->wait_for_monitor(2);
|
||||
|
@ -138,7 +138,7 @@ int main(int argc, char** argv)
|
||||
"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]);
|
||||
snprintf(cmd, sizeof(cmd), CHANGE_CMD_FMT, test.repl->IP_private[0], test.repl->port[0]);
|
||||
MYSQL** nodes = test.repl->nodes;
|
||||
mysql_query(nodes[ind], cmd);
|
||||
mysql_query(nodes[ind], "START SLAVE;");
|
||||
|
@ -123,8 +123,8 @@ int main(int argc, char** argv)
|
||||
test.repl->connect();
|
||||
if (find_field(conn, sstatus_query.c_str(), "Master_Host", result) == 0)
|
||||
{
|
||||
test.expect(strcmp(result, test.repl->IP[0]) == 0,
|
||||
"server3 did not rejoin the cluster (%s != %s).", result, test.repl->IP[0]);
|
||||
test.expect(strcmp(result, test.repl->IP_private[0]) == 0,
|
||||
"server3 did not rejoin the cluster (%s != %s).", result, test.repl->IP_private[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -112,7 +112,7 @@ int main(int argc, char** argv)
|
||||
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';";
|
||||
char cmd[256];
|
||||
snprintf(cmd, sizeof(cmd), CHANGE_CMD_FMT, test.repl->IP[3], test.repl->port[3]);
|
||||
snprintf(cmd, sizeof(cmd), CHANGE_CMD_FMT, test.repl->IP_private[3], test.repl->port[3]);
|
||||
mysql_query(nodes[0], cmd);
|
||||
mysql_query(nodes[0], "START SLAVE;");
|
||||
test.maxscales->wait_for_monitor();
|
||||
|
@ -375,9 +375,9 @@ int Nodes::read_basic_env()
|
||||
|
||||
sprintf(env_name, "%s_%03d_hostname", prefix, i);
|
||||
hostname[i] = strdup(get_nc_item(env_name).c_str());
|
||||
if (hostname[i] == NULL)
|
||||
if ((hostname[i] == NULL) || (strcmp(hostname[i], "") == 0))
|
||||
{
|
||||
hostname[i] = IP[i];
|
||||
hostname[i] = IP_private[i];
|
||||
}
|
||||
setenv(env_name, hostname[i], 1);
|
||||
|
||||
|
@ -838,7 +838,7 @@ void TestConnections::process_template(int m, const char* template_name, const c
|
||||
}
|
||||
else
|
||||
{
|
||||
IPcnf = mdn[j]->IP[i];
|
||||
IPcnf = mdn[j]->IP_private[i];
|
||||
}
|
||||
sprintf(str, "sed -i \"s/###%s_server_IP_%0d###/%s/\" maxscale.cnf",
|
||||
mdn[j]->prefix, i + 1, IPcnf);
|
||||
@ -1198,7 +1198,7 @@ int TestConnections::start_binlog(int m)
|
||||
try_query(repl->nodes[1], "SET @@global.gtid_slave_pos=''");
|
||||
sprintf(sys1,
|
||||
"CHANGE MASTER TO MASTER_HOST='%s', MASTER_PORT=%d, MASTER_USER='repl', MASTER_PASSWORD='repl', MASTER_USE_GTID=Slave_pos",
|
||||
repl->IP[0],
|
||||
repl->IP_private[0],
|
||||
repl->port[0]);
|
||||
try_query(repl->nodes[1], "%s", sys1);
|
||||
try_query(repl->nodes[1], "start slave");
|
||||
@ -1216,7 +1216,7 @@ int TestConnections::start_binlog(int m)
|
||||
// repl->no_set_pos = true;
|
||||
repl->no_set_pos = false;
|
||||
tprintf("Configure first backend slave node to be slave of real master\n");
|
||||
repl->set_slave(repl->nodes[1], repl->IP[0], repl->port[0], log_file, log_pos);
|
||||
repl->set_slave(repl->nodes[1], repl->IP_private[0], repl->port[0], log_file, log_pos);
|
||||
}
|
||||
|
||||
if (!local_maxscale)
|
||||
@ -1243,7 +1243,7 @@ int TestConnections::start_binlog(int m)
|
||||
try_query(binlog, "SET @@global.gtid_slave_pos=''");
|
||||
sprintf(sys1,
|
||||
"CHANGE MASTER TO MASTER_HOST='%s', MASTER_PORT=%d, MASTER_USER='repl', MASTER_PASSWORD='repl', MASTER_USE_GTID=Slave_pos",
|
||||
repl->IP[0],
|
||||
repl->IP_private[0],
|
||||
repl->port[0]);
|
||||
try_query(binlog, "%s", sys1);
|
||||
}
|
||||
@ -1251,7 +1251,7 @@ int TestConnections::start_binlog(int m)
|
||||
{
|
||||
repl->no_set_pos = true;
|
||||
tprintf("configuring Maxscale binlog router\n");
|
||||
repl->set_slave(binlog, repl->IP[0], repl->port[0], log_file, log_pos);
|
||||
repl->set_slave(binlog, repl->IP_private[0], repl->port[0], log_file, log_pos);
|
||||
}
|
||||
// ssl between binlog router and Master
|
||||
if (backend_ssl)
|
||||
@ -1278,7 +1278,7 @@ int TestConnections::start_binlog(int m)
|
||||
try_query(repl->nodes[i], "SET @@global.gtid_slave_pos=''");
|
||||
sprintf(sys1,
|
||||
"CHANGE MASTER TO MASTER_HOST='%s', MASTER_PORT=%d, MASTER_USER='repl', MASTER_PASSWORD='repl', MASTER_USE_GTID=Slave_pos",
|
||||
maxscales->IP[m],
|
||||
maxscales->IP_private[m],
|
||||
maxscales->binlog_port[m]);
|
||||
try_query(repl->nodes[i], "%s", sys1);
|
||||
try_query(repl->nodes[i], "start slave");
|
||||
@ -1301,7 +1301,7 @@ int TestConnections::start_binlog(int m)
|
||||
for (i = 2; i < repl->N; i++)
|
||||
{
|
||||
try_query(repl->nodes[i], "stop slave");
|
||||
repl->set_slave(repl->nodes[i], maxscales->IP[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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1341,7 +1341,7 @@ 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)
|
||||
|| repl->set_slave(conn, repl->IP_private[0], repl->port[0], log_file, log_pos)
|
||||
|| execute_query(conn, "start slave"))
|
||||
{
|
||||
rval = false;
|
||||
@ -1362,7 +1362,7 @@ void TestConnections::revert_replicate_from_master()
|
||||
|
||||
for (int i = 1; i < repl->N; i++)
|
||||
{
|
||||
repl->set_slave(repl->nodes[i], repl->IP[0], repl->port[0], log_file, (char*)"4");
|
||||
repl->set_slave(repl->nodes[i], repl->IP_private[0], repl->port[0], log_file, (char*)"4");
|
||||
execute_query(repl->nodes[i], "start slave");
|
||||
}
|
||||
}
|
||||
@ -1402,8 +1402,8 @@ int TestConnections::start_mm(int m)
|
||||
find_field(repl->nodes[1], (char*) "show master status", (char*) "File", log_file2);
|
||||
find_field(repl->nodes[1], (char*) "show master status", (char*) "Position", log_pos2);
|
||||
|
||||
repl->set_slave(repl->nodes[0], repl->IP[1], repl->port[1], log_file2, log_pos2);
|
||||
repl->set_slave(repl->nodes[1], repl->IP[0], repl->port[0], log_file1, log_pos1);
|
||||
repl->set_slave(repl->nodes[0], repl->IP_private[1], repl->port[1], log_file2, log_pos2);
|
||||
repl->set_slave(repl->nodes[1], repl->IP_private[0], repl->port[0], log_file1, log_pos1);
|
||||
|
||||
repl->close_connections();
|
||||
|
||||
|
@ -11,7 +11,7 @@ function(add_template_manual name template)
|
||||
endfunction()
|
||||
|
||||
# Default test timeout
|
||||
set(TIMEOUT 900)
|
||||
set(TIMEOUT 3600)
|
||||
|
||||
# This functions adds a source file as an executable, links that file against
|
||||
# the common test core and creates a test from it. The first parameter is the
|
||||
|
Loading…
x
Reference in New Issue
Block a user