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

@ -16,6 +16,7 @@
*/
#include <maxscale/config.h>
#include <maxscale/config.hh>
#include <ctype.h>
#include <ftw.h>
@ -4309,3 +4310,32 @@ bool config_parse_disk_space_threshold(MxsDiskSpaceThreshold* pDisk_space_thresh
return success;
}
namespace maxscale
{
ParamList::ParamList(std::initializer_list<std::pair<const char*, const char*>> list,
const MXS_MODULE_PARAM* module_params)
{
for (auto&& a : list)
{
config_add_param(&m_ctx, a.first, a.second);
}
if (module_params)
{
config_add_defaults(&m_ctx, module_params);
}
}
ParamList::~ParamList()
{
config_parameter_free(m_ctx.parameters);
}
MXS_CONFIG_PARAMETER* ParamList::params()
{
return m_ctx.parameters;
}
}