MXS-1423: CHANGE MASTER TO tests with GTID option set

MXS-1423: CHANGE MASTER TO tests with GTID option set
This commit is contained in:
MassimilianoPinto 2017-09-20 10:17:32 +02:00
parent 1b009f94cf
commit 825e1478a1
2 changed files with 86 additions and 0 deletions

View File

@ -9062,6 +9062,8 @@ static bool blr_change_binlog_name(ROUTER_INSTANCE *router,
else
{
*new_logfile = MXS_STRDUP_A("");
// Blank the error message
error[0] = 0;
}
}
}

View File

@ -712,6 +712,90 @@ int main(int argc, char **argv)
tests++;
/**
* MASTER_USE_GTID tests
*/
/**
* Test 24: use MASTER_LOG_FILE without MASTER_USE_GTID=Slave_pos
* in state != BLRM_UNCONFIGURED
*
* Expected rc = -1
*/
inst->master_state = BLRM_UNCONNECTED;
inst->mariadb10_compat = 1;
inst->mariadb10_gtid = 1;
inst->mariadb10_master_gtid = 1;
strcpy(error_string, "");
strncpy(inst->binlog_name, "file.100506", BINLOG_FNAMELEN);
inst->current_pos = 138;
strcpy(inst->fileroot, "file");
sprintf(query,
"CHANGE MASTER TO MASTER_LOG_POS=1991, "
"MASTER_LOG_FILE='%s'",
inst->binlog_name);
rc = blr_test_handle_change_master(inst, query, error_string);
if (rc == -1)
{
printf("Test %d PASSED, GTID cannot set MASTER_LOG_FILE "
"for [%s], Message [%s]\n",
tests,
query,
error_string);
}
else
{
printf("Test %d: GTID set MASTER_LOG_FILE FAILED, "
"Master State is %s. Message [%s]\n",
tests,
blrm_states[inst->master_state], error_string);
return 1;
}
tests++;
/**
* Test 25: use MASTER_USE_GTID=Slave_pos with MASTER_LOG_FILE=''
* and MASTER_LOG_POS = 9999
* in state != BLRM_UNCONFIGURED
*
* Expected rc = -1
*/
inst->master_state = BLRM_UNCONNECTED;
inst->mariadb10_compat = 1;
inst->mariadb10_gtid = 1;
inst->mariadb10_master_gtid = 1;
strcpy(error_string, "");
strncpy(inst->binlog_name, "file.100506", BINLOG_FNAMELEN);
inst->current_pos = 328;
strcpy(inst->fileroot, "file");
strcpy(query,
"CHANGE MASTER TO MASTER_LOG_POS=1991, MASTER_USE_GTID=Slave_pos, "
"MASTER_LOG_FILE=''");
rc = blr_test_handle_change_master(inst, query, error_string);
if (rc == -1)
{
printf("Test %d: GTID set MASTER_USE_GTID=Slave_pos FAILED, "
"Master State is %s. Message [%s]\n",
tests,
blrm_states[inst->master_state], error_string);
return 1;
}
else
{
printf("Test %d PASSED, GTID set MASTER_USE_GTID=Slave_pos "
"for [%s]: %s\n",
tests,
query,error_string);
}
tests++;
/**
* Verify SQL query initial comment skipping function works on a real use case.
*/