Tidy up libabyss test

pull/480/head
Michael 5 years ago
parent 25f10d5b11
commit efb61da56a
No known key found for this signature in database
GPG Key ID: 2D51757B47E2434C

@ -21,6 +21,7 @@ struct AbyssTestBase : public ::testing::Test
AbyssTestBase()
{
llarp::SetLogLevel(llarp::eLogDebug);
}
void
@ -29,13 +30,6 @@ struct AbyssTestBase : public ::testing::Test
ASSERT_EQ(meth, method);
}
void
SetUp()
{
llarp::SetLogLevel(llarp::eLogDebug);
// for llarp::randint
}
static void
CancelIt(void* u, __attribute__((unused)) uint64_t orig, uint64_t left)
{
@ -55,7 +49,7 @@ struct AbyssTestBase : public ::testing::Test
{
threadpool = llarp_init_same_process_threadpool();
llarp_ev_loop_alloc(&loop);
logic.reset(new llarp::Logic(threadpool));
logic = std::make_unique< llarp::Logic >(threadpool);
sockaddr_in addr;
addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
@ -78,8 +72,6 @@ struct AbyssTestBase : public ::testing::Test
Stop()
{
llarp::LogDebug("test case Stop() called");
if(server)
server->Close();
llarp_ev_loop_stop(loop);
}
@ -89,8 +81,7 @@ struct AbyssTestBase : public ::testing::Test
logic->queue_job({this, &StopIt});
}
void
TearDown()
~AbyssTestBase()
{
logic.reset();
llarp_ev_loop_free(&loop);
@ -141,6 +132,10 @@ struct ServerHandler : public abyss::httpd::IRPCHandler
test->called = true;
return Response();
}
~ServerHandler()
{
}
};
struct AbyssTest : public AbyssTestBase,
@ -151,8 +146,9 @@ struct AbyssTest : public AbyssTestBase,
: AbyssTestBase()
, abyss::http::JSONRPC()
, abyss::httpd::BaseReqHandler(1000)
{
client = this;
server = this;
}
abyss::http::IRPCClientHandler*
@ -167,14 +163,6 @@ struct AbyssTest : public AbyssTestBase,
return new ServerHandler(impl, this);
}
void
SetUp()
{
AbyssTestBase::SetUp();
client = this;
server = this;
}
static void
FlushIt(void* u)
{

Loading…
Cancel
Save