Fix explicit server allocation

The test cases allocated servers in a way that doesn't comfortably suit
the way the servers are now allocated. Adding a helper C++ class to load
module defaults makes it easier to do explicit server initialization in
tests.

The binlogrouter was also fixed in this commit as it uses servers much
like a test would use.
This commit is contained in:
Markus Mäkelä
2018-07-14 23:23:56 +03:00
parent df94ef990c
commit 4e8ac8dd4f
5 changed files with 118 additions and 15 deletions

View File

@ -52,6 +52,7 @@
// This isn't really a clean way of testing
#include "../../../../core/internal/service.h"
#include <maxscale/config.hh>
static void printVersion(const char *progname);
static void printUsage(const char *progname);
@ -126,8 +127,18 @@ int main(int argc, char **argv)
service_add_parameters(service, &p);
}
SERVER* server = server_alloc("binlog_router_master_host", "_none_", 3306,
"MySQLBackend", "MySQLBackendAuth");
// Declared in config.cc and needs to be removed if/when blr is refactored
extern const MXS_MODULE_PARAM config_server_params[];
mxs::ParamList p(
{
{"address", "_none_"},
{"port", "3306"},
{"protocol", "MySQLBackend"},
{"authenticator", "MySQLBackendAuth"}
}, config_server_params);
SERVER* server = server_alloc("binlog_router_master_host", p.params());
if (server == NULL)
{
printf("Failed to allocate 'server' object\n");