From 5e6abe71f121c0de6abaf8aa7e049dc2ba4da875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 13 Sep 2018 15:36:31 +0300 Subject: [PATCH] Fix local_address The test did not create a grant for the gateway IP address where the client was connecting from. --- maxscale-system-test/local_address.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/maxscale-system-test/local_address.cpp b/maxscale-system-test/local_address.cpp index 79313c103..4be02d258 100644 --- a/maxscale-system-test/local_address.cpp +++ b/maxscale-system-test/local_address.cpp @@ -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& 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& 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");