MXS-1509: Initial implementation of test case

Added some code to detect server states in a consistent manner and created
the test. The multi-source replication appeared to cause problems for the
test system which needs to be resolved.

Added --force flags to most direct `mysql` calls to prevent errors from
stopping the processing of remaining commands.
This commit is contained in:
Markus Mäkelä
2017-11-23 12:58:21 +02:00
parent d5d41349ae
commit 016b0f69f7
5 changed files with 189 additions and 12 deletions

View File

@ -1918,6 +1918,46 @@ int TestConnections::find_master_maxadmin(Mariadb_nodes * nodes)
return master;
}
StringSet TestConnections::get_server_status(const char* name)
{
std::set<std::string> rval;
char* res = ssh_maxscale_output(true, "maxadmin list servers|grep \'%s\'", name);
char* pipe = strrchr(res, '|');
if (res && pipe)
{
pipe++;
char* tok = strtok(pipe, ",");
while (tok)
{
char* p = tok;
char *end = strchr(tok, '\n');
if (!end)
end = strchr(tok, '\0');
// Trim leading whitespace
while (p < end && isspace(*p))
{
p++;
}
// Trim trailing whitespace
while (end > tok && isspace(*end))
{
*end-- = '\0';
}
rval.insert(p);
tok = strtok(NULL, ",\n");
}
free(res);
}
return rval;
}
int TestConnections::find_slave_maxadmin(Mariadb_nodes * nodes)
{
int slave = -1;