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.
This commit is contained in:
@ -13,6 +13,7 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <future>
|
#include <future>
|
||||||
|
#include <regex>
|
||||||
#include <maxbase/stacktrace.hh>
|
#include <maxbase/stacktrace.hh>
|
||||||
|
|
||||||
#include "mariadb_func.h"
|
#include "mariadb_func.h"
|
||||||
@ -247,18 +248,23 @@ TestConnections::TestConnections(int argc, char* argv[])
|
|||||||
|
|
||||||
case 'l':
|
case 'l':
|
||||||
{
|
{
|
||||||
const char* local_ip = optarg ? optarg : "127.0.0.1";
|
printf("MaxScale assumed to be running locally; "
|
||||||
printf(
|
"not started and logs not downloaded.");
|
||||||
"MaxScale assumed to be running locally; not started and logs not downloaded. IP: %s\n",
|
|
||||||
local_ip);
|
|
||||||
|
|
||||||
|
maxscale::start = false;
|
||||||
|
maxscale::manual_debug = true;
|
||||||
maxscale_init = false;
|
maxscale_init = false;
|
||||||
|
|
||||||
no_maxscale_log_copy = true;
|
no_maxscale_log_copy = true;
|
||||||
local_maxscale = true;
|
local_maxscale = true;
|
||||||
|
|
||||||
setenv("maxscale_IP", local_ip, true);
|
std::regex regex1("maxscale_000_network=[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+");
|
||||||
setenv("maxscale_network", local_ip, true);
|
std::string replace1("maxscale_000_network=127.0.0.1");
|
||||||
setenv("maxscale_private_ip", local_ip, true);
|
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;
|
break;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user