MXS-2196: Fix core unit tests

Fixed the tests so that they properly allocate a service and a listener
for it after which a new session and a DCB are created.
This commit is contained in:
Markus Mäkelä
2018-12-03 21:19:03 +02:00
parent 43c33e9f4a
commit cb18670013
3 changed files with 20 additions and 3 deletions

View File

@ -38,6 +38,8 @@
#include <maxscale/service.hh>
#include "test_utils.h"
#include "../internal/service.hh"
#include "../internal/session.hh"
/**
* test1 Allocate a service and do lots of other things
@ -54,7 +56,11 @@ static int test1()
"testpoll : Initialise the polling system.");
init_test_env(NULL);
fprintf(stderr, "\t..done\nAdd a DCB");
dcb = dcb_alloc(DCB_ROLE_CLIENT_HANDLER, nullptr);
auto service = service_alloc("service", "readconnroute", nullptr);
auto listener = Listener::create(service, "listener", "mariadbclient", "0.0.0.0", 3306, "", "", nullptr);
auto session = new mxs::Session(listener);
dcb = dcb_alloc(DCB_ROLE_CLIENT_HANDLER, session);
if (dcb == NULL)
{