From 9faed003e0ae270fa5f8c92b78d56dc22c775e67 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Tue, 10 Sep 2019 15:34:56 +0300 Subject: [PATCH] MXS-2669 Make '-l' work again When a system test program is invoked with the flag '-l', it will assume MaxScale is running on 127.0.0.1 using a configuration that is compatible with the test. NOTE: Currently any test that directly or indirectly sshes to the MaxScale node will fail. With a bit of setup that could also be made to work. --- maxscale-system-test/testconnections.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/maxscale-system-test/testconnections.cpp b/maxscale-system-test/testconnections.cpp index caf5e3f64..0971dcdf6 100644 --- a/maxscale-system-test/testconnections.cpp +++ b/maxscale-system-test/testconnections.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include "mariadb_func.h" @@ -247,18 +248,23 @@ TestConnections::TestConnections(int argc, char* argv[]) case 'l': { - const char* local_ip = optarg ? optarg : "127.0.0.1"; - printf( - "MaxScale assumed to be running locally; not started and logs not downloaded. IP: %s\n", - local_ip); + printf("MaxScale assumed to be running locally; " + "not started and logs not downloaded."); + maxscale::start = false; + maxscale::manual_debug = true; maxscale_init = false; + no_maxscale_log_copy = true; local_maxscale = true; - setenv("maxscale_IP", local_ip, true); - setenv("maxscale_network", local_ip, true); - setenv("maxscale_private_ip", local_ip, true); + std::regex regex1("maxscale_000_network=[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+"); + std::string replace1("maxscale_000_network=127.0.0.1"); + network_config = regex_replace(network_config, regex1, replace1); + + std::regex regex2("maxscale_000_private_ip=[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+"); + std::string replace2("maxscale_000_private_ip=127.0.0.1"); + network_config = regex_replace(network_config, regex2, replace2); } break;