Fix local_address

The test did not create a grant for the gateway IP address where the
client was connecting from.
This commit is contained in:
Markus Mäkelä 2018-09-13 15:36:31 +03:00
parent bee7cc2002
commit 5e6abe71f1
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -216,6 +216,16 @@ string get_local_ip(TestConnections& test)
return trim(output);
}
string get_gateway_ip(TestConnections& test)
{
int exit_code;
char* output = test.maxscales->ssh_node_output(0, "echo $SSH_CLIENT", false, &exit_code);
*strchr(output, ' ') = '\0';
string rval(output);
free(output);
return rval;
}
void start_maxscale_with_local_address(TestConnections& test,
const string& replace,
const string& with)
@ -268,6 +278,7 @@ void run_test(TestConnections& test, const vector<string>& ips)
string ip2 = (ips.size() > 1) ? ips[1] : string("42.42.42.42");
string local_ip = get_local_ip(test);
string gateway_ip = get_gateway_ip(test);
const char* zUser1 = "alice";
const char* zUser2 = "bob";
@ -276,8 +287,10 @@ void run_test(TestConnections& test, const vector<string>& ips)
create_user_and_grants(test, zUser1, zPassword1, ip1);
create_user_and_grants(test, zUser1, zPassword1, local_ip);
create_user_and_grants(test, zUser1, zPassword1, gateway_ip);
create_user_and_grants(test, zUser2, zPassword2, ip2);
create_user_and_grants(test, zUser2, zPassword2, local_ip);
create_user_and_grants(test, zUser2, zPassword2, gateway_ip);
test.repl->sync_slaves();
test.tprintf("\n");