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

@ -38,6 +38,7 @@
#include <maxscale/alloc.h>
#include <maxscale/atomic.h>
#include <maxscale/config.hh>
#include <maxscale/dcb.h>
#include <maxscale/housekeeper.h>
#include <maxscale/log_manager.h>
@ -762,12 +763,19 @@ static MXS_ROUTER* createInstance(SERVICE *service, MXS_CONFIG_PARAMETER* params
/* Dynamically allocate master_host server struct, not written in any cnf file */
if (service->dbref == NULL)
{
SERVER *server;
SSL_LISTENER *ssl_cfg;
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)
{
MXS_ERROR("%s: Error for server_alloc in createInstance",