Squashed commit of the following:

commit 48a0b902b67da46f1eed4afa687bdcb56b59d02f
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Mon Dec 16 15:35:07 2019 +0200

    Increase timouts in the mxs173_trottle_filter test

commit 81d8083a89421a8004b8024d480ae0f35d715b86
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Mon Dec 16 14:19:39 2019 +0200

    Increase timeouts in max1071_maxrow test

commit e1039c6132f0e9274b8801165f3f905ede7c9421
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Mon Dec 16 00:06:53 2019 +0200

    Remove hardcoded 'home/vagrant/' from all maxscale.cnf in system tests

commit 28c8029e060afdcf5159bf802b13dcd5e484d9f1
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Sun Dec 15 21:31:34 2019 +0200

    Use private IP for Galera congiguration in maxscale-system-tests

commit 66dc36cbf43a5fb92465df31e1295e82865be1fc
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Sun Dec 15 09:06:28 2019 +0200

    Fix typos in fwf_*.cpp

commit 44c7a4384ddf39596c0254c955aeb6c008a00a35
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Sun Dec 15 09:05:26 2019 +0200

    Fix typos in fwf_*.cpp

commit 2649017611908a8b0d27090f49722947ac31c4f4
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Sun Dec 15 09:03:41 2019 +0200

    Fix typos in fwf_*.cpp

commit 5cc87658523e8496eaab17700be8a821af5b0cde
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Sat Dec 14 23:54:53 2019 +0200

    Fix typo in fwf_copy_rules.cpp

commit fb1accc36cb9d79691469f63cb4535f3bc38dedd
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Sat Dec 14 23:52:51 2019 +0200

    More hardcoded 'vagrant' removals

commit 77e49d474b4abe767629ff87b01f08137773d761
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Sat Dec 14 23:35:09 2019 +0200

    Fix hardcoded 'vagrant' user in fwf* tests

    Several firewall filter tests has hardcoded 'vagrant' as a user name for
    access user on the VM. Changed to node->access_user.

commit ed5ab1487f37822db6a7478f76c0f3652776c389
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Sat Dec 14 22:50:35 2019 +0200

    Fix IP vs IP_private

    Many tests use IP instead of IP_private which makes them failed in the
    AWS or GCloud environment.
    The same applies to get_conn_num() etc functions.

commit 0558aac23d303a675dc12d05b1766e698753b444
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Thu Aug 15 12:02:01 2019 +0300

    fix IP -> IP_private for some mysqlmon* testst

commit 5d9c70970d970eb995c8774d0088bd1c54ab76fe
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Sat Dec 14 20:20:51 2019 +0200

    Replace IP to IP_private in the maxscale-system-tests

commit b06cf3329af59ff100748691991213fe639f29e6
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Tue Nov 19 11:52:33 2019 +0200

    Remove spaces from value which were read from *_network_config

    MDBCI can put spaces around values in the *_network_config file which
    can cause ssh connection failures in the tests. To fix it removing all
    spaces from all values which were read from *_network_config

commit b3904f019847ef1db9d4ec9714ad9ef869fa0b01
Author: Timofey Turenko <timofey.turenko@mariadb.com>
Date:   Thu Dec 12 23:36:31 2019 +0200

    Increate default timeout for all system tests
This commit is contained in:
Timofey Turenko
2019-12-16 15:41:52 +02:00
parent 41c1ce441a
commit e1fc0b8734
31 changed files with 88 additions and 90 deletions

View File

@ -183,10 +183,10 @@ int main(int argc, char* argv[])
Test->set_timeout(60); Test->set_timeout(60);
num_conn = num_conn =
get_conn_num(Test->repl->nodes[i], get_conn_num(Test->repl->nodes[i],
Test->maxscales->IP[0], Test->maxscales->IP_private[0],
Test->maxscales->hostname[0], Test->maxscales->hostname[0],
(char*) "test"); (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)) if ((i == 0) && (num_conn > 2 * conn_N))
{ {
Test->add_result(1, "too many connections to master\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); Test->set_timeout(60);
num_conn = num_conn =
get_conn_num(Test->repl->nodes[i], get_conn_num(Test->repl->nodes[i],
Test->maxscales->IP[0], Test->maxscales->IP_private[0],
Test->maxscales->hostname[0], Test->maxscales->hostname[0],
(char*) "test"); (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)) if ((i == 0) && (num_conn > 2 * conn_N))
{ {
Test->add_result(1, "too many connections to master\n"); Test->add_result(1, "too many connections to master\n");
@ -223,10 +223,10 @@ int main(int argc, char* argv[])
{ {
num_conn = num_conn =
get_conn_num(Test->repl->nodes[i], get_conn_num(Test->repl->nodes[i],
Test->maxscales->IP[0], Test->maxscales->IP_private[0],
Test->maxscales->hostname[0], Test->maxscales->hostname[0],
(char*) "test"); (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)) if ((i == 0) && (num_conn > 2 * conn_N))
{ {
Test->add_result(1, "too many connections to master\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); Test->set_timeout(60);
num_conn = num_conn =
get_conn_num(Test->repl->nodes[i], get_conn_num(Test->repl->nodes[i],
Test->maxscales->IP[0], Test->maxscales->IP_private[0],
Test->maxscales->hostname[0], Test->maxscales->hostname[0],
(char*) "test"); (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)) if ((i == 0) && (num_conn != 0))
{ {
Test->add_result(1, "there are still connections to master\n"); 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); Test->set_timeout(60);
num_conn = num_conn =
get_conn_num(Test->repl->nodes[i], get_conn_num(Test->repl->nodes[i],
Test->maxscales->IP[0], Test->maxscales->IP_private[0],
Test->maxscales->hostname[0], Test->maxscales->hostname[0],
(char*) "test"); (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)) if ((i == 0) && (num_conn != 0))
{ {
Test->add_result(1, "there are still connections to master\n"); 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); Test->set_timeout(60);
num_conn = num_conn =
get_conn_num(Test->repl->nodes[i], get_conn_num(Test->repl->nodes[i],
Test->maxscales->IP[0], Test->maxscales->IP_private[0],
Test->maxscales->hostname[0], Test->maxscales->hostname[0],
(char*) "test"); (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)) if ((i == 0) && (num_conn != 0))
{ {
Test->add_result(1, "there are still connections to master\n"); 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); Test->set_timeout(60);
num_conn = num_conn =
get_conn_num(Test->repl->nodes[i], get_conn_num(Test->repl->nodes[i],
Test->maxscales->IP[0], Test->maxscales->IP_private[0],
Test->maxscales->hostname[0], Test->maxscales->hostname[0],
(char*) "test"); (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)) if ((i == 0) && (num_conn != 0))
{ {
Test->add_result(1, "there are still connections to master\n"); Test->add_result(1, "there are still connections to master\n");

View File

@ -20,7 +20,7 @@ monitor_interval=1000
[Masking] [Masking]
type=filter type=filter
module=masking module=masking
rules=/home/vagrant/masking_auto_firewall.json rules=/###access_homedir###/masking_auto_firewall.json
warn_type_mismatch=always warn_type_mismatch=always
large_payload=ignore large_payload=ignore
treat_string_arg_as_field=false treat_string_arg_as_field=false

View File

@ -20,7 +20,7 @@ monitor_interval=1000
[Masking] [Masking]
type=filter type=filter
module=masking module=masking
rules=/home/vagrant/mxs1719.json rules=/###access_homedir###/mxs1719.json
warn_type_mismatch=always warn_type_mismatch=always
large_payload=ignore large_payload=ignore
require_fully_parsed=false require_fully_parsed=false

View File

@ -27,7 +27,7 @@ port = 4006
[lua] [lua]
type = filter type = filter
module = luafilter module = luafilter
session_script=/home/vagrant/infinite_loop.lua session_script=/###access_homedir###/infinite_loop.lua
[MaxAdmin-Service] [MaxAdmin-Service]
type = service type = service

View File

@ -83,7 +83,7 @@ void Config::create_server(int num)
true, true,
"maxadmin create server server%d %s %d", "maxadmin create server server%d %s %d",
num, num,
test_->repl->IP[num], test_->repl->IP_private[num],
test_->repl->port[num]); test_->repl->port[num]);
created_servers_.insert(num); created_servers_.insert(num);
test_->stop_timeout(); test_->stop_timeout();

View File

@ -6,6 +6,16 @@ void copy_rules(TestConnections* Test, const char* rules_name, const char* rules
std::stringstream src; std::stringstream src;
std::stringstream dest; 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; src << rules_dir << "/" << rules_name;
dest << Test->maxscales->access_homedir[0] << "/rules/rules.txt"; dest << Test->maxscales->access_homedir[0] << "/rules/rules.txt";

View File

@ -35,14 +35,6 @@ int main(int argc, char* argv[])
char rules_dir[4096]; char rules_dir[4096];
FILE* file; 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); sprintf(rules_dir, "%s/fw/", test_dir);
int N = 19; int N = 19;
int i; int i;

View File

@ -5,6 +5,7 @@
*/ */
#include "testconnections.h" #include "testconnections.h"
#include "fw_copy_rules.h"
const char* rules = "rule test1 deny regex '.*'\n" const char* rules = "rule test1 deny regex '.*'\n"
"users %@% match any rules test1\n"; "users %@% match any rules test1\n";
@ -19,11 +20,7 @@ int main(int argc, char** argv)
TestConnections::skip_maxscale_start(true); TestConnections::skip_maxscale_start(true);
TestConnections test(argc, argv); TestConnections test(argc, argv);
test.maxscales->ssh_node(0, copy_rules(&test, (char*) "rules.txt", (char*) ".");
"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);
test.maxscales->restart_maxscale(0); test.maxscales->restart_maxscale(0);
test.maxscales->connect_maxscale(0); test.maxscales->connect_maxscale(0);

View File

@ -5,6 +5,7 @@
*/ */
#include "testconnections.h" #include "testconnections.h"
#include "fw_copy_rules.h"
const char* rules = "rule test1 deny no_where_clause\n" const char* rules = "rule test1 deny no_where_clause\n"
"rule test1 deny columns a b c\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::skip_maxscale_start(true);
TestConnections test(argc, argv); TestConnections test(argc, argv);
test.maxscales->ssh_node(0, copy_rules(&test, (char*) "rules.txt", (char*) ".");
"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);
int rc = 0; int rc = 0;

View File

@ -6,17 +6,21 @@
*/ */
#include "testconnections.h" #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) 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::skip_maxscale_start(true);
TestConnections test(argc, argv); TestConnections test(argc, argv);
test.maxscales->ssh_node_f(0,
true, copy_rules(&test, (char*) "rules.txt", (char*) ".");
"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;");
test.add_result(test.maxscales->restart_maxscale(0), "Restarting MaxScale failed"); test.add_result(test.maxscales->restart_maxscale(0), "Restarting MaxScale failed");

View File

@ -71,5 +71,6 @@ void stop_keepalived(TestConnections* Test)
for (int i = 0; i < Test->maxscales->N; i++) for (int i = 0; i < Test->maxscales->N; i++)
{ {
Test->maxscales->ssh_node(i, "sudo service keepalived stop", true); Test->maxscales->ssh_node(i, "sudo service keepalived stop", true);
Test->maxscales->ssh_node(i, "killall -9 keepalived", true);
} }
} }

View File

@ -462,7 +462,7 @@ int get_conn_num(MYSQL* conn, std::string ip, std::string hostname, std::string
row = mysql_fetch_row(res); row = mysql_fetch_row(res);
if ((row[2] != NULL ) && (row[3] != NULL)) 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++; conn_num++;
} }

View File

@ -229,7 +229,7 @@ int Mariadb_nodes::find_master()
i = 0; i = 0;
while ((found == 0) && (i < N)) while ((found == 0) && (i < N))
{ {
if (strcmp(IP[i], master_IP) == 0) if (strcmp(IP_private[i], master_IP) == 0)
{ {
found = 1; found = 1;
master_node = i; master_node = i;
@ -267,7 +267,7 @@ void Mariadb_nodes::change_master(int NewMaster, int OldMaster)
if (i != NewMaster && mysql_ping(nodes[i]) == 0) if (i != NewMaster && mysql_ping(nodes[i]) == 0)
{ {
char str[1024]; 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); execute_query(nodes[i], "%s", str);
} }
} }
@ -438,7 +438,7 @@ int Galera_nodes::start_galera()
true, true,
"sed -i 's/###NODE-ADDRESS###/%s/' /etc/my.cnf.d/* /etc/mysql/my.cnf.d/*;" "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/*", "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"); printf("Starting new Galera cluster\n");
@ -1437,7 +1437,7 @@ int Mariadb_nodes::prepare_servers()
void Mariadb_nodes::replicate_from(int slave, int master, const char* type) void Mariadb_nodes::replicate_from(int slave, int master, const char* type)
{ {
std::stringstream change_master; std::stringstream change_master;
change_master << "CHANGE MASTER TO MASTER_HOST = '" << IP[master] change_master << "CHANGE MASTER TO MASTER_HOST = '" << IP_private[master]
<< "', MASTER_PORT = " << port[master] << ", MASTER_USE_GTID = " << type << ", " << "', MASTER_PORT = " << port[master] << ", MASTER_USE_GTID = " << type << ", "
"MASTER_USER='repl', MASTER_PASSWORD='repl';"; "MASTER_USER='repl', MASTER_PASSWORD='repl';";
@ -1473,7 +1473,7 @@ std::string Mariadb_nodes::cnf_servers()
cnf_server_name + cnf_server_name +
std::to_string(i + 1) + std::to_string(i + 1) +
std::string("]\\ntype=server\\naddress=") + std::string("]\\ntype=server\\naddress=") +
std::string(IP[i]) + std::string(IP_private[i]) +
std::string("\\nport=") + std::string("\\nport=") +
std::to_string(port[i]) + std::to_string(port[i]) +
std::string("\\nprotocol=MySQLBackend\\n"); std::string("\\nprotocol=MySQLBackend\\n");

View File

@ -173,7 +173,7 @@ int main(int argc, char* argv[])
std::string json_file("/masking_auto_firewall.json"); std::string json_file("/masking_auto_firewall.json");
std::string from = test_dir + json_file; 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) if (test.maxscales->copy_to_node(0, from.c_str(), to.c_str()) == 0)
{ {

View File

@ -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* rows = new my_ulonglong[30];
my_ulonglong i; my_ulonglong i;
Test->set_timeout(30); Test->set_timeout(90);
execute_query_num_of_rows(Test->maxscales->conn_rwsplit[0], sql, rows, &i); execute_query_num_of_rows(Test->maxscales->conn_rwsplit[0], sql, rows, &i);
Test->tprintf("Result sets number is %llu\n", 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* rows = new my_ulonglong[30];
my_ulonglong i; my_ulonglong i;
Test->set_timeout(30); Test->set_timeout(90);
execute_stmt_num_of_rows(stmt, rows, &i); execute_stmt_num_of_rows(stmt, rows, &i);
Test->tprintf("Result sets number is %llu\n", i); Test->tprintf("Result sets number is %llu\n", i);

View File

@ -27,13 +27,6 @@ int main(int argc, char* argv[])
Test->maxscales->copy_to_node_legacy(cache_rules.c_str(), "~/", 0); 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()); copy_rules(Test, "rules2", fw_rules.c_str());
Test->maxscales->start_maxscale(0); Test->maxscales->start_maxscale(0);

View File

@ -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;" "CHANGE MASTER %s TO master_host='%s', master_port=3306, master_user='%s', master_password='%s', master_use_gtid=slave_pos;"
"START ALL SLAVES", "START ALL SLAVES",
source.c_str(), source.c_str(),
test.repl->IP[master], test.repl->IP_private[master],
test.repl->user_name, test.repl->user_name,
test.repl->password); test.repl->password);
} }

View File

@ -78,8 +78,9 @@ int main(int argc, char* argv[])
TestConnections test(argc, argv); TestConnections test(argc, argv);
std::string src = test_dir; std::string src = test_dir;
src += "/mxs1719.json"; 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) if (test.maxscales->start() == 0)
{ {

View File

@ -13,6 +13,8 @@
DEFINE_EXCEPTION(Whoopsy); DEFINE_EXCEPTION(Whoopsy);
#define TIMEOUT 300
// TODO these should be read from maxscale.cnf. Maybe the test-lib should replace // 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. // any "###ENV_VAR###", with environment variables so that code and conf can share.
constexpr int max_qps = 500; constexpr int max_qps = 500;
@ -196,26 +198,26 @@ int main(int argc, char* argv[])
test.maxscales->connect_maxscale(0); test.maxscales->connect_maxscale(0);
std::cout << "Create table\n"; std::cout << "Create table\n";
test.set_timeout(120); test.set_timeout(TIMEOUT);
create_table(test.maxscales->conn_master[0]); create_table(test.maxscales->conn_master[0]);
std::cout << "Insert rows\n"; std::cout << "Insert rows\n";
test.set_timeout(120); test.set_timeout(TIMEOUT);
insert_rows(test.maxscales->conn_master[0]); insert_rows(test.maxscales->conn_master[0]);
test.set_timeout(120); test.set_timeout(TIMEOUT);
gauge_raw_speed(test); gauge_raw_speed(test);
test.stop_timeout(); test.stop_timeout();
test.repl->sync_slaves(); test.repl->sync_slaves();
test.set_timeout(120); test.set_timeout(TIMEOUT);
verify_throttling_performace(test); verify_throttling_performace(test);
test.maxscales->close_maxscale_connections(0); test.maxscales->close_maxscale_connections(0);
test.maxscales->connect_maxscale(0); test.maxscales->connect_maxscale(0);
test.set_timeout(120); test.set_timeout(TIMEOUT);
verify_throttling_disconnect(test); verify_throttling_disconnect(test);
std::cout << "\n\n"; std::cout << "\n\n";

View File

@ -78,7 +78,7 @@ int main(int argc, char* argv[])
std::string lua_file("/infinite_loop.lua"); std::string lua_file("/infinite_loop.lua");
std::string from = test_dir + lua_file; 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->copy_to_node(0, from.c_str(), to.c_str());
test.maxscales->start(); test.maxscales->start();

View File

@ -77,7 +77,7 @@ int main(int argc, char* argv[])
true, true,
"maxadmin create server server%d 3306 %s", "maxadmin create server server%d 3306 %s",
i + 1, i + 1,
test->repl->IP[i]); test->repl->IP_private[i]);
} }
/** Add the servers to the monitor and service */ /** Add the servers to the monitor and service */
@ -96,7 +96,7 @@ int main(int argc, char* argv[])
true, true,
"maxadmin create server server%d %s %d", "maxadmin create server server%d %s %d",
i + 1, i + 1,
test->repl->IP[i], test->repl->IP_private[i],
test->repl->port[i]); test->repl->port[i]);
} }

View File

@ -56,7 +56,7 @@ int main(int argc, char* argv[])
config.create_server(1); config.create_server(1);
config.add_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); sleep(1);
test->check_maxscale_alive(0); test->check_maxscale_alive(0);
config.alter_server(1, "address", "This-is-not-the-address-you-are-looking-for"); config.alter_server(1, "address", "This-is-not-the-address-you-are-looking-for");

View File

@ -32,7 +32,7 @@ void check_maxscale(TestConnections& test)
void replicate_from(TestConnections& test, int server_ind, int target_ind) void replicate_from(TestConnections& test, int server_ind, int target_ind)
{ {
stringstream change_master; 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_PORT = " << test.repl->port[target_ind] << ", MASTER_USE_GTID = current_pos, "
"MASTER_USER='repl', MASTER_PASSWORD='repl';"; "MASTER_USER='repl', MASTER_PASSWORD='repl';";
cout << "Server " << server_ind + 1 << " starting to replicate from server " << target_ind + 1 << endl; cout << "Server " << server_ind + 1 << " starting to replicate from server " << target_ind + 1 << endl;

View File

@ -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; " "master_user='repl', master_password='repl', master_delay=%d; "
"START SLAVE '%s';"; "START SLAVE '%s';";
test.try_query(test.repl->nodes[slave], query, conn_name.c_str(), 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()); replication_delay, conn_name.c_str());
} }

View File

@ -120,7 +120,7 @@ int main(int argc, char** argv)
const char CHANGE_CMD_FMT[] = "CHANGE MASTER TO MASTER_HOST = '%s', MASTER_PORT = %d, " 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 change_cmd[256]; 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], "%s", change_cmd);
test.try_query(nodes[0], "START SLAVE;"); test.try_query(nodes[0], "START SLAVE;");
test.maxscales->wait_for_monitor(2); test.maxscales->wait_for_monitor(2);

View File

@ -138,7 +138,7 @@ int main(int argc, char** argv)
"MASTER_USER='repl', MASTER_PASSWORD = 'repl';"; "MASTER_USER='repl', MASTER_PASSWORD = 'repl';";
char cmd[256]; char cmd[256];
int ind = master_id_new - 1; 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** nodes = test.repl->nodes;
mysql_query(nodes[ind], cmd); mysql_query(nodes[ind], cmd);
mysql_query(nodes[ind], "START SLAVE;"); mysql_query(nodes[ind], "START SLAVE;");

View File

@ -123,8 +123,8 @@ int main(int argc, char** argv)
test.repl->connect(); test.repl->connect();
if (find_field(conn, sstatus_query.c_str(), "Master_Host", result) == 0) if (find_field(conn, sstatus_query.c_str(), "Master_Host", result) == 0)
{ {
test.expect(strcmp(result, test.repl->IP[0]) == 0, test.expect(strcmp(result, test.repl->IP_private[0]) == 0,
"server3 did not rejoin the cluster (%s != %s).", result, test.repl->IP[0]); "server3 did not rejoin the cluster (%s != %s).", result, test.repl->IP_private[0]);
} }
else else
{ {

View File

@ -112,7 +112,7 @@ int main(int argc, char** argv)
const char CHANGE_CMD_FMT[] = "CHANGE MASTER TO MASTER_HOST = '%s', MASTER_PORT = %d, " 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]; 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], cmd);
mysql_query(nodes[0], "START SLAVE;"); mysql_query(nodes[0], "START SLAVE;");
test.maxscales->wait_for_monitor(); test.maxscales->wait_for_monitor();

View File

@ -370,9 +370,9 @@ int Nodes::read_basic_env()
sprintf(env_name, "%s_%03d_hostname", prefix, i); sprintf(env_name, "%s_%03d_hostname", prefix, i);
hostname[i] = strdup(get_nc_item(env_name).c_str()); 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); setenv(env_name, hostname[i], 1);
@ -416,6 +416,7 @@ std::string Nodes::get_nc_item(const char* item_name)
} }
std::string str = network_config.substr(equal + 1, end - equal - 1); std::string str = network_config.substr(equal + 1, end - equal - 1);
str.erase(remove(str.begin(), str.end(), ' '), str.end());
setenv(item_name, str.c_str(), 1); setenv(item_name, str.c_str(), 1);

View File

@ -775,7 +775,7 @@ void TestConnections::process_template(int m, const char* template_name, const c
} }
else else
{ {
IPcnf = mdn[j]->IP[i]; IPcnf = mdn[j]->IP_private[i];
} }
sprintf(str, "sed -i \"s/###%s_server_IP_%0d###/%s/\" maxscale.cnf", sprintf(str, "sed -i \"s/###%s_server_IP_%0d###/%s/\" maxscale.cnf",
mdn[j]->prefix, i + 1, IPcnf); mdn[j]->prefix, i + 1, IPcnf);
@ -1131,7 +1131,7 @@ int TestConnections::start_binlog(int m)
try_query(repl->nodes[1], "SET @@global.gtid_slave_pos=''"); try_query(repl->nodes[1], "SET @@global.gtid_slave_pos=''");
sprintf(sys1, sprintf(sys1,
"CHANGE MASTER TO MASTER_HOST='%s', MASTER_PORT=%d, MASTER_USER='repl', MASTER_PASSWORD='repl', MASTER_USE_GTID=Slave_pos", "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]); repl->port[0]);
try_query(repl->nodes[1], "%s", sys1); try_query(repl->nodes[1], "%s", sys1);
try_query(repl->nodes[1], "start slave"); try_query(repl->nodes[1], "start slave");
@ -1149,7 +1149,7 @@ int TestConnections::start_binlog(int m)
// repl->no_set_pos = true; // repl->no_set_pos = true;
repl->no_set_pos = false; repl->no_set_pos = false;
tprintf("Configure first backend slave node to be slave of real master\n"); 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) if (!local_maxscale)
@ -1176,7 +1176,7 @@ int TestConnections::start_binlog(int m)
try_query(binlog, "SET @@global.gtid_slave_pos=''"); try_query(binlog, "SET @@global.gtid_slave_pos=''");
sprintf(sys1, sprintf(sys1,
"CHANGE MASTER TO MASTER_HOST='%s', MASTER_PORT=%d, MASTER_USER='repl', MASTER_PASSWORD='repl', MASTER_USE_GTID=Slave_pos", "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]); repl->port[0]);
try_query(binlog, "%s", sys1); try_query(binlog, "%s", sys1);
} }
@ -1184,7 +1184,7 @@ int TestConnections::start_binlog(int m)
{ {
repl->no_set_pos = true; repl->no_set_pos = true;
tprintf("configuring Maxscale binlog router\n"); 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 // ssl between binlog router and Master
if (backend_ssl) if (backend_ssl)
@ -1211,7 +1211,7 @@ int TestConnections::start_binlog(int m)
try_query(repl->nodes[i], "SET @@global.gtid_slave_pos=''"); try_query(repl->nodes[i], "SET @@global.gtid_slave_pos=''");
sprintf(sys1, sprintf(sys1,
"CHANGE MASTER TO MASTER_HOST='%s', MASTER_PORT=%d, MASTER_USER='repl', MASTER_PASSWORD='repl', MASTER_USE_GTID=Slave_pos", "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]); maxscales->binlog_port[m]);
try_query(repl->nodes[i], "%s", sys1); try_query(repl->nodes[i], "%s", sys1);
try_query(repl->nodes[i], "start slave"); try_query(repl->nodes[i], "start slave");
@ -1234,7 +1234,7 @@ 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[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);
} }
} }
@ -1274,7 +1274,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); 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) 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")) || execute_query(conn, "start slave"))
{ {
rval = false; rval = false;
@ -1295,7 +1295,7 @@ void TestConnections::revert_replicate_from_master()
for (int i = 1; i < repl->N; i++) 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"); execute_query(repl->nodes[i], "start slave");
} }
} }
@ -1335,8 +1335,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*) "File", log_file2);
find_field(repl->nodes[1], (char*) "show master status", (char*) "Position", log_pos2); 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[0], repl->IP_private[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[1], repl->IP_private[0], repl->port[0], log_file1, log_pos1);
repl->close_connections(); repl->close_connections();

View File

@ -11,7 +11,7 @@ function(add_template_manual name template)
endfunction() endfunction()
# Default test timeout # Default test timeout
set(TIMEOUT 900) set(TIMEOUT 3600)
# This functions adds a source file as an executable, links that file against # 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 # the common test core and creates a test from it. The first parameter is the