Merge branch '2.3' into 2.4
This commit is contained in:
@ -17,8 +17,8 @@
|
|||||||
|
|
||||||
typedef std::set<std::string> StringSet;
|
typedef std::set<std::string> StringSet;
|
||||||
|
|
||||||
#define MDBCI_FAUILT 200 // Exit code for the case when failure caused by MDBCI non-zero exit
|
#define MDBCI_FAUILT 200// Exit code for the case when failure caused by MDBCI non-zero exit
|
||||||
#define BROKEN_VM_FAUILT 201 // Exit code for the case when failure caused by screwed VMs
|
#define BROKEN_VM_FAUILT 201// Exit code for the case when failure caused by screwed VMs
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Class contains references to Master/Slave and Galera test setups
|
* @brief Class contains references to Master/Slave and Galera test setups
|
||||||
@ -51,10 +51,6 @@ typedef std::set<std::string> StringSet;
|
|||||||
*/
|
*/
|
||||||
class TestConnections
|
class TestConnections
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
/** Whether timeouts are enabled or not */
|
|
||||||
bool enable_timeouts;
|
|
||||||
bool log_matches(int m, const char* pattern);
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief TestConnections constructor: reads environmental variables, copies MaxScale.cnf for MaxScale
|
* @brief TestConnections constructor: reads environmental variables, copies MaxScale.cnf for MaxScale
|
||||||
@ -93,7 +89,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @brief galera Mariadb_nodes object containing references to Galera setuo
|
* @brief galera Mariadb_nodes object containing references to Galera setuo
|
||||||
*/
|
*/
|
||||||
Galera_nodes * galera;
|
Galera_nodes* galera;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief repl Mariadb_nodes object containing references to Master/Slave setuo
|
* @brief repl Mariadb_nodes object containing references to Master/Slave setuo
|
||||||
@ -107,47 +103,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
Maxscales* maxscales;
|
Maxscales* maxscales;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief mdbci_config_name Name of MDBCI VMs set
|
|
||||||
*/
|
|
||||||
char * mdbci_config_name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief mdbci_vm_path Path to directory with MDBCI VMs descriptions
|
|
||||||
*/
|
|
||||||
char * mdbci_vm_path;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief mdbci_temlate Name of mdbci VMs tempate file
|
|
||||||
*/
|
|
||||||
char * mdbci_template;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief target Name of Maxscale repository in the CI
|
|
||||||
*/
|
|
||||||
char * target;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief GetLogsCommand Command to copy log files from node virtual machines (should handle one
|
|
||||||
* parameter: IP address of virtual machine to kill)
|
|
||||||
*/
|
|
||||||
char * get_logs_command;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief make_snapshot_command Command line to create a snapshot of all VMs
|
|
||||||
*/
|
|
||||||
char * take_snapshot_command;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief revert_snapshot_command Command line to revert a snapshot of all VMs
|
|
||||||
*/
|
|
||||||
char * revert_snapshot_command;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief use_snapshots if TRUE every test is trying to revert snapshot before running the test
|
|
||||||
*/
|
|
||||||
bool use_snapshots;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief SysbenchDir path to SysBench directory (sysbanch should be >= 0.5)
|
* @brief SysbenchDir path to SysBench directory (sysbanch should be >= 0.5)
|
||||||
*/
|
*/
|
||||||
@ -161,26 +116,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
int copy_mariadb_logs(Mariadb_nodes* nrepl, const char* prefix, std::vector<std::thread>& threads);
|
int copy_mariadb_logs(Mariadb_nodes* nrepl, const char* prefix, std::vector<std::thread>& threads);
|
||||||
|
|
||||||
/**
|
std::string network_config; /**< Content of MDBCI network_config file */
|
||||||
* @brief MaxScale runs locally, specified using -l.
|
|
||||||
*/
|
|
||||||
bool local_maxscale;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief network_config Content of MDBCI network_config file
|
|
||||||
*/
|
|
||||||
std::string network_config;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief no_backend_log_copy if true logs from backends are not copied
|
|
||||||
* (needed if case of Aurora RDS backend or similar)
|
|
||||||
*/
|
|
||||||
bool no_backend_log_copy;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Do not download MaxScale logs.
|
|
||||||
*/
|
|
||||||
bool no_maxscale_log_copy;
|
|
||||||
/**
|
/**
|
||||||
* @brief verbose if true more printing activated
|
* @brief verbose if true more printing activated
|
||||||
*/
|
*/
|
||||||
@ -218,27 +155,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool binlog_slave_gtid;
|
bool binlog_slave_gtid;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief no_repl Do not check, restart and use Maxster/Slave setup;
|
|
||||||
*/
|
|
||||||
bool no_repl;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief no_galera Do not check, restart and use Galera setup; all Galera tests will fail
|
|
||||||
*/
|
|
||||||
bool no_galera;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief no_clustrix Do not check, restart and use Clustrix setup
|
* @brief no_clustrix Do not check, restart and use Clustrix setup
|
||||||
*/
|
*/
|
||||||
bool no_clustrix;
|
bool no_clustrix;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief no_vm_revert If true tests do not revert VMs after the test even if test failed
|
|
||||||
* (use it for debugging)
|
|
||||||
*/
|
|
||||||
bool no_vm_revert;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ssl_options string with ssl configuration for command line client
|
* @brief ssl_options string with ssl configuration for command line client
|
||||||
*/
|
*/
|
||||||
@ -646,7 +567,6 @@ public:
|
|||||||
void check_current_connections(int m, int value);
|
void check_current_connections(int m, int value);
|
||||||
int stop_maxscale(int m = 0);
|
int stop_maxscale(int m = 0);
|
||||||
int start_maxscale(int m = 0);
|
int start_maxscale(int m = 0);
|
||||||
void process_template(const char* src, const char* dest = "/etc/maxscale.cnf");
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current master server id from the cluster, as seen by rwsplit.
|
* Get the current master server id from the cluster, as seen by rwsplit.
|
||||||
@ -661,7 +581,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @param func Function to call
|
* @param func Function to call
|
||||||
*/
|
*/
|
||||||
void on_destroy(std::function<void (void)> func)
|
void on_destroy(std::function<void(void)> func)
|
||||||
{
|
{
|
||||||
m_on_destroy.push_back(func);
|
m_on_destroy.push_back(func);
|
||||||
}
|
}
|
||||||
@ -677,7 +597,7 @@ public:
|
|||||||
* @brief call_mdbci Execute MDBCI to bring up nodes
|
* @brief call_mdbci Execute MDBCI to bring up nodes
|
||||||
* @return 0 if success
|
* @return 0 if success
|
||||||
*/
|
*/
|
||||||
int call_mdbci(const char *options);
|
int call_mdbci(const char* options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief resinstall_maxscales Remove Maxscale form all nodes and installs new ones
|
* @brief resinstall_maxscales Remove Maxscale form all nodes and installs new ones
|
||||||
@ -693,12 +613,9 @@ private:
|
|||||||
void set_template_and_labels();
|
void set_template_and_labels();
|
||||||
void set_mdbci_labels();
|
void set_mdbci_labels();
|
||||||
bool has_label(std::string labels, std::string label);
|
bool has_label(std::string labels, std::string label);
|
||||||
|
bool log_matches(int m, const char* pattern);
|
||||||
|
|
||||||
bool too_many_maxscales() const
|
bool too_many_maxscales() const;
|
||||||
{
|
|
||||||
return maxscales->N < 2
|
|
||||||
&& m_mdbci_labels.find("SECOND_MAXSCALE") != std::string::npos;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::function<void(void)>> m_on_destroy;
|
std::vector<std::function<void(void)>> m_on_destroy;
|
||||||
|
|
||||||
@ -706,6 +623,35 @@ private:
|
|||||||
std::string m_config_template; /**< MaxScale config file template used by test */
|
std::string m_config_template; /**< MaxScale config file template used by test */
|
||||||
std::string m_labels; /**< Test labels */
|
std::string m_labels; /**< Test labels */
|
||||||
std::string m_mdbci_labels; /**< Labels for MDBCI */
|
std::string m_mdbci_labels; /**< Labels for MDBCI */
|
||||||
|
|
||||||
|
char* m_mdbci_config_name; /**< Name of MDBCI VMs set */
|
||||||
|
char* m_mdbci_vm_path; /**< Path to directory with MDBCI VMs descriptions */
|
||||||
|
char* m_mdbci_template; /**< Name of mdbci VMs tempate file */
|
||||||
|
char* m_target; /**< Name of Maxscale repository in the CI */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Command to copy log files from node virtual machines (should handle one parameter: IP address of
|
||||||
|
* virtual machine to kill) */
|
||||||
|
char* m_get_logs_command;
|
||||||
|
|
||||||
|
char* m_take_snapshot_command; /**< Command line to create a snapshot of all VMs */
|
||||||
|
char* m_revert_snapshot_command; /**< Command line to revert a snapshot of all VMs */
|
||||||
|
|
||||||
|
bool m_enable_timeouts {true}; /**< Whether timeouts are enabled or not */
|
||||||
|
bool m_local_maxscale {false}; /**< MaxScale runs locally, specified using -l. */
|
||||||
|
|
||||||
|
/**< If true, every test is trying to revert snapshot before running the test. Unused for now. */
|
||||||
|
bool m_use_snapshots {false};
|
||||||
|
|
||||||
|
/* If true, logs from backends are not copied (needed if case of Aurora RDS backend or similar) */
|
||||||
|
bool m_no_backend_log_copy {false};
|
||||||
|
bool m_no_maxscale_log_copy {false}; /**< Do not download MaxScale logs. */
|
||||||
|
|
||||||
|
bool no_repl {false}; /**< Do not check, restart and use Master/Slave setup */
|
||||||
|
bool no_galera {false}; /**< Do not check, restart and use Galera setup; all Galera tests will fail */
|
||||||
|
|
||||||
|
/** If true tests do not revert VMs after the test even if test failed (use it for debugging) */
|
||||||
|
bool no_vm_revert {true};
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -125,21 +125,14 @@ void TestConnections::restart_galera(bool value)
|
|||||||
bool TestConnections::verbose = false;
|
bool TestConnections::verbose = false;
|
||||||
|
|
||||||
TestConnections::TestConnections(int argc, char* argv[])
|
TestConnections::TestConnections(int argc, char* argv[])
|
||||||
: enable_timeouts(true)
|
: global_result(0)
|
||||||
, global_result(0)
|
|
||||||
, use_snapshots(false)
|
|
||||||
, local_maxscale(false)
|
|
||||||
, no_backend_log_copy(false)
|
|
||||||
, no_maxscale_log_copy(false)
|
|
||||||
, smoke(true)
|
, smoke(true)
|
||||||
, binlog_cmd_option(0)
|
, binlog_cmd_option(0)
|
||||||
, ssl(false)
|
, ssl(false)
|
||||||
, backend_ssl(false)
|
, backend_ssl(false)
|
||||||
, binlog_master_gtid(false)
|
, binlog_master_gtid(false)
|
||||||
, binlog_slave_gtid(false)
|
, binlog_slave_gtid(false)
|
||||||
, no_galera(false)
|
|
||||||
, no_clustrix(false)
|
, no_clustrix(false)
|
||||||
, no_vm_revert(true)
|
|
||||||
, threads(4)
|
, threads(4)
|
||||||
, use_ipv6(false)
|
, use_ipv6(false)
|
||||||
{
|
{
|
||||||
@ -239,7 +232,7 @@ TestConnections::TestConnections(int argc, char* argv[])
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'z':
|
case 'z':
|
||||||
enable_timeouts = false;
|
m_enable_timeouts = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'y':
|
case 'y':
|
||||||
@ -255,9 +248,8 @@ TestConnections::TestConnections(int argc, char* argv[])
|
|||||||
maxscale::start = false;
|
maxscale::start = false;
|
||||||
maxscale::manual_debug = true;
|
maxscale::manual_debug = true;
|
||||||
maxscale_init = false;
|
maxscale_init = false;
|
||||||
|
m_no_maxscale_log_copy = true;
|
||||||
no_maxscale_log_copy = true;
|
m_local_maxscale = true;
|
||||||
local_maxscale = true;
|
|
||||||
|
|
||||||
std::regex regex1("maxscale_000_network=[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+");
|
std::regex regex1("maxscale_000_network=[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+");
|
||||||
std::string replace1("maxscale_000_network=127.0.0.1");
|
std::string replace1("maxscale_000_network=127.0.0.1");
|
||||||
@ -348,8 +340,8 @@ TestConnections::TestConnections(int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get_logs_command = (char *) malloc(strlen(test_dir) + 14);
|
m_get_logs_command = (char *) malloc(strlen(test_dir) + 14);
|
||||||
sprintf(get_logs_command, "%s/get_logs.sh", test_dir);
|
sprintf(m_get_logs_command, "%s/get_logs.sh", test_dir);
|
||||||
|
|
||||||
sprintf(ssl_options,
|
sprintf(ssl_options,
|
||||||
"--ssl-cert=%s/ssl-cert/client-cert.pem --ssl-key=%s/ssl-cert/client-key.pem",
|
"--ssl-cert=%s/ssl-cert/client-cert.pem --ssl-key=%s/ssl-cert/client-key.pem",
|
||||||
@ -371,8 +363,8 @@ TestConnections::TestConnections(int argc, char* argv[])
|
|||||||
repl = new Mariadb_nodes("node", test_dir, verbose, network_config);
|
repl = new Mariadb_nodes("node", test_dir, verbose, network_config);
|
||||||
repl->setup();
|
repl->setup();
|
||||||
repl->use_ipv6 = use_ipv6;
|
repl->use_ipv6 = use_ipv6;
|
||||||
repl->take_snapshot_command = take_snapshot_command;
|
repl->take_snapshot_command = m_take_snapshot_command;
|
||||||
repl->revert_snapshot_command = revert_snapshot_command;
|
repl->revert_snapshot_command = m_revert_snapshot_command;
|
||||||
repl_future = std::async(std::launch::async, &Mariadb_nodes::check_nodes, repl);
|
repl_future = std::async(std::launch::async, &Mariadb_nodes::check_nodes, repl);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -385,8 +377,8 @@ TestConnections::TestConnections(int argc, char* argv[])
|
|||||||
galera = new Galera_nodes("galera", test_dir, verbose, network_config);
|
galera = new Galera_nodes("galera", test_dir, verbose, network_config);
|
||||||
galera->setup();
|
galera->setup();
|
||||||
galera->use_ipv6 = false;
|
galera->use_ipv6 = false;
|
||||||
galera->take_snapshot_command = take_snapshot_command;
|
galera->take_snapshot_command = m_take_snapshot_command;
|
||||||
galera->revert_snapshot_command = revert_snapshot_command;
|
galera->revert_snapshot_command = m_revert_snapshot_command;
|
||||||
galera_future = std::async(std::launch::async, &Galera_nodes::check_nodes, galera);
|
galera_future = std::async(std::launch::async, &Galera_nodes::check_nodes, galera);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -399,8 +391,8 @@ TestConnections::TestConnections(int argc, char* argv[])
|
|||||||
clustrix = new Clustrix_nodes("clustrix", test_dir, verbose, network_config);
|
clustrix = new Clustrix_nodes("clustrix", test_dir, verbose, network_config);
|
||||||
clustrix->setup();
|
clustrix->setup();
|
||||||
clustrix->use_ipv6 = false;
|
clustrix->use_ipv6 = false;
|
||||||
clustrix->take_snapshot_command = take_snapshot_command;
|
clustrix->take_snapshot_command = m_take_snapshot_command;
|
||||||
clustrix->revert_snapshot_command = revert_snapshot_command;
|
clustrix->revert_snapshot_command = m_revert_snapshot_command;
|
||||||
clustrix->fix_replication();
|
clustrix->fix_replication();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -434,7 +426,7 @@ TestConnections::TestConnections(int argc, char* argv[])
|
|||||||
|
|
||||||
if (reinstall_maxscales())
|
if (reinstall_maxscales())
|
||||||
{
|
{
|
||||||
tprintf("Failed to install Maxscale: target is %s", target);
|
tprintf("Failed to install Maxscale: target is %s", m_target);
|
||||||
exit(MDBCI_FAUILT);
|
exit(MDBCI_FAUILT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -655,21 +647,21 @@ void TestConnections::expect(bool result, const char* format, ...)
|
|||||||
|
|
||||||
void TestConnections::read_mdbci_info()
|
void TestConnections::read_mdbci_info()
|
||||||
{
|
{
|
||||||
mdbci_vm_path = readenv("MDBCI_VM_PATH", "%s/vms/", getenv("HOME"));
|
m_mdbci_vm_path = readenv("MDBCI_VM_PATH", "%s/vms/", getenv("HOME"));
|
||||||
|
|
||||||
if (system((std::string("mkdir -p ") +
|
if (system((std::string("mkdir -p ") +
|
||||||
std::string(mdbci_vm_path)).c_str()))
|
std::string(m_mdbci_vm_path)).c_str()))
|
||||||
{
|
{
|
||||||
tprintf("Unable to create MDBCI VMs direcory '%s', exiting", mdbci_vm_path);
|
tprintf("Unable to create MDBCI VMs direcory '%s', exiting", m_mdbci_vm_path);
|
||||||
exit(MDBCI_FAUILT);
|
exit(MDBCI_FAUILT);
|
||||||
}
|
}
|
||||||
mdbci_template = readenv("template", "default");
|
m_mdbci_template = readenv("template", "default");
|
||||||
target = readenv("target", "develop");
|
m_target = readenv("target", "develop");
|
||||||
|
|
||||||
mdbci_config_name = readenv("mdbci_config_name", "local");
|
m_mdbci_config_name = readenv("mdbci_config_name", "local");
|
||||||
vm_path = std::string(mdbci_vm_path) + "/" + std::string(mdbci_config_name);
|
vm_path = std::string(m_mdbci_vm_path) + "/" + std::string(m_mdbci_config_name);
|
||||||
|
|
||||||
if (mdbci_config_name != NULL)
|
if (m_mdbci_config_name != NULL)
|
||||||
{
|
{
|
||||||
std::ifstream nc_file;
|
std::ifstream nc_file;
|
||||||
nc_file.open(vm_path + "_network_config");
|
nc_file.open(vm_path + "_network_config");
|
||||||
@ -715,17 +707,17 @@ void TestConnections::read_env()
|
|||||||
maxscale::start = false;
|
maxscale::start = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
no_backend_log_copy = readenv_bool("no_backend_log_copy", false);
|
m_no_backend_log_copy = readenv_bool("no_backend_log_copy", false);
|
||||||
no_maxscale_log_copy = readenv_bool("no_maxscale_log_copy", false);
|
m_no_maxscale_log_copy = readenv_bool("no_maxscale_log_copy", false);
|
||||||
use_ipv6 = readenv_bool("use_ipv6", false);
|
use_ipv6 = readenv_bool("use_ipv6", false);
|
||||||
backend_ssl = readenv_bool("backend_ssl", false);
|
backend_ssl = readenv_bool("backend_ssl", false);
|
||||||
smoke = readenv_bool("smoke", false);
|
smoke = readenv_bool("smoke", false);
|
||||||
threads = readenv_int("threads", 4);
|
threads = readenv_int("threads", 4);
|
||||||
use_snapshots = readenv_bool("use_snapshots", false);
|
m_use_snapshots = readenv_bool("use_snapshots", false);
|
||||||
take_snapshot_command = readenv("take_snapshot_command",
|
m_take_snapshot_command = readenv("take_snapshot_command",
|
||||||
"mdbci snapshot take --path-to-nodes %s --snapshot-name ", mdbci_config_name);
|
"mdbci snapshot take --path-to-nodes %s --snapshot-name ", m_mdbci_config_name);
|
||||||
revert_snapshot_command = readenv("revert_snapshot_command",
|
m_revert_snapshot_command = readenv("revert_snapshot_command",
|
||||||
"mdbci snapshot revert --path-to-nodes %s --snapshot-name ", mdbci_config_name);
|
"mdbci snapshot revert --path-to-nodes %s --snapshot-name ", m_mdbci_config_name);
|
||||||
no_vm_revert = readenv_bool("no_vm_revert", true);
|
no_vm_revert = readenv_bool("no_vm_revert", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -995,7 +987,7 @@ int TestConnections::copy_all_logs()
|
|||||||
|
|
||||||
std::vector<std::thread> threads;
|
std::vector<std::thread> threads;
|
||||||
|
|
||||||
if (!no_backend_log_copy)
|
if (!m_no_backend_log_copy)
|
||||||
{
|
{
|
||||||
copy_mariadb_logs(repl, "node", threads);
|
copy_mariadb_logs(repl, "node", threads);
|
||||||
copy_mariadb_logs(galera, "galera", threads);
|
copy_mariadb_logs(galera, "galera", threads);
|
||||||
@ -1003,7 +995,7 @@ int TestConnections::copy_all_logs()
|
|||||||
|
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
|
|
||||||
if (!no_maxscale_log_copy)
|
if (!m_no_maxscale_log_copy)
|
||||||
{
|
{
|
||||||
rv = copy_maxscale_logs(0);
|
rv = copy_maxscale_logs(0);
|
||||||
}
|
}
|
||||||
@ -1095,7 +1087,7 @@ int TestConnections::prepare_binlog(int m)
|
|||||||
"Error editing maxscale.cnf");
|
"Error editing maxscale.cnf");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!local_maxscale)
|
if (!m_local_maxscale)
|
||||||
{
|
{
|
||||||
tprintf("Removing all binlog data from Maxscale node");
|
tprintf("Removing all binlog data from Maxscale node");
|
||||||
add_result(maxscales->ssh_node_f(m, true, "rm -rf %s", maxscales->maxscale_binlog_dir[m]),
|
add_result(maxscales->ssh_node_f(m, true, "rm -rf %s", maxscales->maxscale_binlog_dir[m]),
|
||||||
@ -1152,7 +1144,7 @@ int TestConnections::start_binlog(int m)
|
|||||||
|
|
||||||
repl->stop_nodes();
|
repl->stop_nodes();
|
||||||
|
|
||||||
if (!local_maxscale)
|
if (!m_local_maxscale)
|
||||||
{
|
{
|
||||||
binlog =
|
binlog =
|
||||||
open_conn_no_db(maxscales->binlog_port[m], maxscales->IP[m], repl->user_name, repl->password,
|
open_conn_no_db(maxscales->binlog_port[m], maxscales->IP[m], repl->user_name, repl->password,
|
||||||
@ -1189,7 +1181,7 @@ int TestConnections::start_binlog(int m)
|
|||||||
prepare_binlog(m);
|
prepare_binlog(m);
|
||||||
tprintf("Testing binlog when MariaDB is started with '%s' option\n", cmd_opt);
|
tprintf("Testing binlog when MariaDB is started with '%s' option\n", cmd_opt);
|
||||||
|
|
||||||
if (!local_maxscale)
|
if (!m_local_maxscale)
|
||||||
{
|
{
|
||||||
tprintf("ls binlog data dir on Maxscale node\n");
|
tprintf("ls binlog data dir on Maxscale node\n");
|
||||||
add_result(maxscales->ssh_node_f(m, true, "ls -la %s/", maxscales->maxscale_binlog_dir[m]),
|
add_result(maxscales->ssh_node_f(m, true, "ls -la %s/", maxscales->maxscale_binlog_dir[m]),
|
||||||
@ -1225,7 +1217,7 @@ int TestConnections::start_binlog(int m)
|
|||||||
repl->set_slave(repl->nodes[1], repl->IP_private[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 (!m_local_maxscale)
|
||||||
{
|
{
|
||||||
tprintf("Starting back Maxscale\n");
|
tprintf("Starting back Maxscale\n");
|
||||||
add_result(maxscales->start_maxscale(m), "Maxscale start failed\n");
|
add_result(maxscales->start_maxscale(m), "Maxscale start failed\n");
|
||||||
@ -1819,7 +1811,7 @@ int TestConnections::get_client_ip(int m, char* ip)
|
|||||||
|
|
||||||
int TestConnections::set_timeout(long int timeout_seconds)
|
int TestConnections::set_timeout(long int timeout_seconds)
|
||||||
{
|
{
|
||||||
if (enable_timeouts)
|
if (m_enable_timeouts)
|
||||||
{
|
{
|
||||||
timeout = timeout_seconds;
|
timeout = timeout_seconds;
|
||||||
}
|
}
|
||||||
@ -2183,15 +2175,15 @@ void TestConnections::check_current_connections(int m, int value)
|
|||||||
|
|
||||||
int TestConnections::take_snapshot(char* snapshot_name)
|
int TestConnections::take_snapshot(char* snapshot_name)
|
||||||
{
|
{
|
||||||
char str[strlen(take_snapshot_command) + strlen(snapshot_name) + 2];
|
char str[strlen(m_take_snapshot_command) + strlen(snapshot_name) + 2];
|
||||||
sprintf(str, "%s %s", take_snapshot_command, snapshot_name);
|
sprintf(str, "%s %s", m_take_snapshot_command, snapshot_name);
|
||||||
return call_system(str);
|
return call_system(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
int TestConnections::revert_snapshot(char* snapshot_name)
|
int TestConnections::revert_snapshot(char* snapshot_name)
|
||||||
{
|
{
|
||||||
char str[strlen(revert_snapshot_command) + strlen(snapshot_name) + 2];
|
char str[strlen(m_revert_snapshot_command) + strlen(snapshot_name) + 2];
|
||||||
sprintf(str, "%s %s", revert_snapshot_command, snapshot_name);
|
sprintf(str, "%s %s", m_revert_snapshot_command, snapshot_name);
|
||||||
return call_system(str);
|
return call_system(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2212,7 +2204,7 @@ int TestConnections::call_mdbci(const char * options)
|
|||||||
{
|
{
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
if (stat(
|
if (stat(
|
||||||
(mdbci_vm_path + std::string("/") + mdbci_config_name).c_str(),
|
(m_mdbci_vm_path + std::string("/") + m_mdbci_config_name).c_str(),
|
||||||
&buf)
|
&buf)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -2224,7 +2216,7 @@ int TestConnections::call_mdbci(const char * options)
|
|||||||
if (system((std::string("mdbci --override --template ") +
|
if (system((std::string("mdbci --override --template ") +
|
||||||
vm_path +
|
vm_path +
|
||||||
std::string(".json generate ") +
|
std::string(".json generate ") +
|
||||||
std::string(mdbci_config_name)).c_str() ))
|
std::string(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;
|
||||||
@ -2241,7 +2233,7 @@ int TestConnections::call_mdbci(const char * options)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (system((std::string("mdbci up ") +
|
if (system((std::string("mdbci up ") +
|
||||||
std::string(mdbci_config_name) +
|
std::string(m_mdbci_config_name) +
|
||||||
std::string(" --labels ") +
|
std::string(" --labels ") +
|
||||||
m_mdbci_labels +
|
m_mdbci_labels +
|
||||||
std::string(" ") +
|
std::string(" ") +
|
||||||
@ -2255,7 +2247,7 @@ int TestConnections::call_mdbci(const char * options)
|
|||||||
system((std::string("mdbci public_keys --key ") +
|
system((std::string("mdbci public_keys --key ") +
|
||||||
team_keys +
|
team_keys +
|
||||||
std::string(" ") +
|
std::string(" ") +
|
||||||
std::string(mdbci_config_name)).c_str() );
|
std::string(m_mdbci_config_name)).c_str() );
|
||||||
read_env();
|
read_env();
|
||||||
if (repl)
|
if (repl)
|
||||||
{
|
{
|
||||||
@ -2297,7 +2289,7 @@ int TestConnections::process_mdbci_template()
|
|||||||
|
|
||||||
std::string name = std::string(test_dir) +
|
std::string name = std::string(test_dir) +
|
||||||
std::string("/mdbci/templates/") +
|
std::string("/mdbci/templates/") +
|
||||||
std::string(mdbci_template) +
|
std::string(m_mdbci_template) +
|
||||||
std::string(".json.template");
|
std::string(".json.template");
|
||||||
|
|
||||||
std::string sys = std::string("envsubst < ") +
|
std::string sys = std::string("envsubst < ") +
|
||||||
@ -2335,8 +2327,8 @@ std::string dump_status(const StringSet& current, const StringSet& expected)
|
|||||||
}
|
}
|
||||||
int TestConnections::reinstall_maxscales()
|
int TestConnections::reinstall_maxscales()
|
||||||
{
|
{
|
||||||
char sys[strlen(target) +
|
char sys[strlen(m_target) +
|
||||||
strlen(mdbci_config_name) +
|
strlen(m_mdbci_config_name) +
|
||||||
strlen(maxscales->prefix) +
|
strlen(maxscales->prefix) +
|
||||||
70];
|
70];
|
||||||
for (int i = 0; i < maxscales->N; i++)
|
for (int i = 0; i < maxscales->N; i++)
|
||||||
@ -2347,7 +2339,7 @@ int TestConnections::reinstall_maxscales()
|
|||||||
maxscales->ssh_node(i, "yum clean all", true);
|
maxscales->ssh_node(i, "yum clean all", true);
|
||||||
|
|
||||||
sprintf(sys, "mdbci install_product --product maxscale_ci --product-version %s %s/%s_%03d",
|
sprintf(sys, "mdbci install_product --product maxscale_ci --product-version %s %s/%s_%03d",
|
||||||
target, mdbci_config_name, maxscales->prefix, i);
|
m_target, m_mdbci_config_name, maxscales->prefix, i);
|
||||||
if (system(sys))
|
if (system(sys))
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
@ -2355,3 +2347,8 @@ int TestConnections::reinstall_maxscales()
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TestConnections::too_many_maxscales() const
|
||||||
|
{
|
||||||
|
return maxscales->N < 2 && m_mdbci_labels.find("SECOND_MAXSCALE") != std::string::npos;
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user