mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Format first-party source according to .clang-format
This commit is contained in:
committed by
manojsdoshi
parent
65dfc5d19e
commit
50760c6935
@@ -19,32 +19,31 @@
|
||||
|
||||
#include <ripple/basics/make_SSLContext.h>
|
||||
#include <ripple/beast/rfc2616.h>
|
||||
#include <ripple/server/Server.h>
|
||||
#include <ripple/server/Session.h>
|
||||
#include <ripple/beast/unit_test.h>
|
||||
#include <ripple/core/ConfigSections.h>
|
||||
#include <ripple/server/Server.h>
|
||||
#include <ripple/server/Session.h>
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/beast/core/tcp_stream.hpp>
|
||||
#include <boost/beast/ssl/ssl_stream.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/utility/in_place_factory.hpp>
|
||||
#include <chrono>
|
||||
#include <stdexcept>
|
||||
#include <test/jtx.h>
|
||||
#include <test/jtx/envconfig.h>
|
||||
#include <test/unit_test/SuiteJournal.h>
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/utility/in_place_factory.hpp>
|
||||
#include <boost/beast/core/tcp_stream.hpp>
|
||||
#include <boost/beast/ssl/ssl_stream.hpp>
|
||||
#include <chrono>
|
||||
#include <stdexcept>
|
||||
#include <thread>
|
||||
|
||||
namespace ripple {
|
||||
namespace test {
|
||||
|
||||
using socket_type = boost::beast::tcp_stream;
|
||||
using stream_type = boost::beast::ssl_stream <socket_type>;
|
||||
using socket_type = boost::beast::tcp_stream;
|
||||
using stream_type = boost::beast::ssl_stream<socket_type>;
|
||||
|
||||
class Server_test : public beast::unit_test::suite
|
||||
{
|
||||
public:
|
||||
|
||||
class TestThread
|
||||
{
|
||||
private:
|
||||
@@ -79,15 +78,14 @@ public:
|
||||
beast::unit_test::suite& suite_;
|
||||
|
||||
public:
|
||||
explicit TestSink (beast::unit_test::suite& suite)
|
||||
: Sink (beast::severities::kWarning, false)
|
||||
, suite_ (suite)
|
||||
explicit TestSink(beast::unit_test::suite& suite)
|
||||
: Sink(beast::severities::kWarning, false), suite_(suite)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
write (beast::severities::Severity level,
|
||||
std::string const& text) override
|
||||
write(beast::severities::Severity level, std::string const& text)
|
||||
override
|
||||
{
|
||||
if (level < threshold())
|
||||
return;
|
||||
@@ -101,52 +99,54 @@ public:
|
||||
struct TestHandler
|
||||
{
|
||||
bool
|
||||
onAccept (Session& session,
|
||||
boost::asio::ip::tcp::endpoint endpoint)
|
||||
onAccept(Session& session, boost::asio::ip::tcp::endpoint endpoint)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Handoff
|
||||
onHandoff (Session& session,
|
||||
std::unique_ptr <stream_type>&& bundle,
|
||||
http_request_type&& request,
|
||||
boost::asio::ip::tcp::endpoint remote_address)
|
||||
onHandoff(
|
||||
Session& session,
|
||||
std::unique_ptr<stream_type>&& bundle,
|
||||
http_request_type&& request,
|
||||
boost::asio::ip::tcp::endpoint remote_address)
|
||||
{
|
||||
return Handoff{};
|
||||
}
|
||||
|
||||
Handoff
|
||||
onHandoff (Session& session, http_request_type&& request,
|
||||
onHandoff(
|
||||
Session& session,
|
||||
http_request_type&& request,
|
||||
boost::asio::ip::tcp::endpoint remote_address)
|
||||
{
|
||||
return Handoff{};
|
||||
}
|
||||
|
||||
void
|
||||
onRequest (Session& session)
|
||||
onRequest(Session& session)
|
||||
{
|
||||
session.write (std::string ("Hello, world!\n"));
|
||||
session.write(std::string("Hello, world!\n"));
|
||||
if (beast::rfc2616::is_keep_alive(session.request()))
|
||||
session.complete();
|
||||
else
|
||||
session.close (true);
|
||||
session.close(true);
|
||||
}
|
||||
|
||||
void
|
||||
onWSMessage(std::shared_ptr<WSSession> session,
|
||||
onWSMessage(
|
||||
std::shared_ptr<WSSession> session,
|
||||
std::vector<boost::asio::const_buffer> const&)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
onClose (Session& session,
|
||||
boost::system::error_code const&)
|
||||
onClose(Session& session, boost::system::error_code const&)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
onStopped (Server& server)
|
||||
onStopped(Server& server)
|
||||
{
|
||||
}
|
||||
};
|
||||
@@ -156,17 +156,17 @@ public:
|
||||
// Connect to an address
|
||||
template <class Socket>
|
||||
bool
|
||||
connect (Socket& s, typename Socket::endpoint_type const& ep)
|
||||
connect(Socket& s, typename Socket::endpoint_type const& ep)
|
||||
{
|
||||
try
|
||||
{
|
||||
s.connect (ep);
|
||||
s.connect(ep);
|
||||
pass();
|
||||
return true;
|
||||
}
|
||||
catch (std::exception const& e)
|
||||
{
|
||||
fail (e.what());
|
||||
fail(e.what());
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -175,17 +175,17 @@ public:
|
||||
// Write a string to the stream
|
||||
template <class SyncWriteStream>
|
||||
bool
|
||||
write (SyncWriteStream& s, std::string const& text)
|
||||
write(SyncWriteStream& s, std::string const& text)
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::asio::write (s, boost::asio::buffer (text));
|
||||
boost::asio::write(s, boost::asio::buffer(text));
|
||||
pass();
|
||||
return true;
|
||||
}
|
||||
catch (std::exception const& e)
|
||||
{
|
||||
fail (e.what());
|
||||
fail(e.what());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -193,18 +193,18 @@ public:
|
||||
// Expect that reading the stream produces a matching string
|
||||
template <class SyncReadStream>
|
||||
bool
|
||||
expect_read (SyncReadStream& s, std::string const& match)
|
||||
expect_read(SyncReadStream& s, std::string const& match)
|
||||
{
|
||||
boost::asio::streambuf b (1000); // limit on read
|
||||
boost::asio::streambuf b(1000); // limit on read
|
||||
try
|
||||
{
|
||||
auto const n = boost::asio::read_until (s, b, '\n');
|
||||
auto const n = boost::asio::read_until(s, b, '\n');
|
||||
if (BEAST_EXPECT(n == match.size()))
|
||||
{
|
||||
std::string got;
|
||||
got.resize (n);
|
||||
boost::asio::buffer_copy (boost::asio::buffer (
|
||||
&got[0], n), b.data());
|
||||
got.resize(n);
|
||||
boost::asio::buffer_copy(
|
||||
boost::asio::buffer(&got[0], n), b.data());
|
||||
return BEAST_EXPECT(got == match);
|
||||
}
|
||||
}
|
||||
@@ -224,24 +224,25 @@ public:
|
||||
{
|
||||
boost::asio::io_service ios;
|
||||
using socket = boost::asio::ip::tcp::socket;
|
||||
socket s (ios);
|
||||
socket s(ios);
|
||||
|
||||
if (! connect (s, ep))
|
||||
if (!connect(s, ep))
|
||||
return;
|
||||
|
||||
if (! write (s,
|
||||
"GET / HTTP/1.1\r\n"
|
||||
"Connection: close\r\n"
|
||||
"\r\n"))
|
||||
if (!write(
|
||||
s,
|
||||
"GET / HTTP/1.1\r\n"
|
||||
"Connection: close\r\n"
|
||||
"\r\n"))
|
||||
return;
|
||||
|
||||
if (! expect_read (s, "Hello, world!\n"))
|
||||
return ;
|
||||
if (!expect_read(s, "Hello, world!\n"))
|
||||
return;
|
||||
|
||||
boost::system::error_code ec;
|
||||
s.shutdown(socket::shutdown_both, ec);
|
||||
|
||||
std::this_thread::sleep_for (std::chrono::seconds (1));
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -249,123 +250,127 @@ public:
|
||||
{
|
||||
boost::asio::io_service ios;
|
||||
using socket = boost::asio::ip::tcp::socket;
|
||||
socket s (ios);
|
||||
socket s(ios);
|
||||
|
||||
if (! connect (s, ep))
|
||||
if (!connect(s, ep))
|
||||
return;
|
||||
|
||||
if (! write (s,
|
||||
"GET / HTTP/1.1\r\n"
|
||||
"Connection: Keep-Alive\r\n"
|
||||
"\r\n"))
|
||||
if (!write(
|
||||
s,
|
||||
"GET / HTTP/1.1\r\n"
|
||||
"Connection: Keep-Alive\r\n"
|
||||
"\r\n"))
|
||||
return;
|
||||
|
||||
if (! expect_read (s, "Hello, world!\n"))
|
||||
return ;
|
||||
|
||||
if (! write (s,
|
||||
"GET / HTTP/1.1\r\n"
|
||||
"Connection: close\r\n"
|
||||
"\r\n"))
|
||||
if (!expect_read(s, "Hello, world!\n"))
|
||||
return;
|
||||
|
||||
if (! expect_read (s, "Hello, world!\n"))
|
||||
return ;
|
||||
if (!write(
|
||||
s,
|
||||
"GET / HTTP/1.1\r\n"
|
||||
"Connection: close\r\n"
|
||||
"\r\n"))
|
||||
return;
|
||||
|
||||
if (!expect_read(s, "Hello, world!\n"))
|
||||
return;
|
||||
|
||||
boost::system::error_code ec;
|
||||
s.shutdown(socket::shutdown_both, ec);
|
||||
}
|
||||
|
||||
void basicTests()
|
||||
void
|
||||
basicTests()
|
||||
{
|
||||
testcase("Basic client/server");
|
||||
TestSink sink {*this};
|
||||
TestSink sink{*this};
|
||||
TestThread thread;
|
||||
sink.threshold (beast::severities::Severity::kAll);
|
||||
beast::Journal journal {sink};
|
||||
sink.threshold(beast::severities::Severity::kAll);
|
||||
beast::Journal journal{sink};
|
||||
TestHandler handler;
|
||||
auto s = make_Server (handler,
|
||||
thread.get_io_service(), journal);
|
||||
auto s = make_Server(handler, thread.get_io_service(), journal);
|
||||
std::vector<Port> serverPort(1);
|
||||
serverPort.back().ip =
|
||||
beast::IP::Address::from_string (getEnvLocalhostAddr()),
|
||||
beast::IP::Address::from_string(getEnvLocalhostAddr()),
|
||||
serverPort.back().port = 0;
|
||||
serverPort.back().protocol.insert("http");
|
||||
auto eps = s->ports (serverPort);
|
||||
auto eps = s->ports(serverPort);
|
||||
log << "server listening on port " << eps[0].port() << std::endl;
|
||||
test_request(eps[0]);
|
||||
test_keepalive(eps[0]);
|
||||
//s->close();
|
||||
// s->close();
|
||||
s = nullptr;
|
||||
pass();
|
||||
}
|
||||
|
||||
void stressTest()
|
||||
void
|
||||
stressTest()
|
||||
{
|
||||
testcase("stress test");
|
||||
struct NullHandler
|
||||
{
|
||||
bool
|
||||
onAccept (Session& session,
|
||||
boost::asio::ip::tcp::endpoint endpoint)
|
||||
onAccept(Session& session, boost::asio::ip::tcp::endpoint endpoint)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Handoff
|
||||
onHandoff (Session& session,
|
||||
std::unique_ptr <stream_type>&& bundle,
|
||||
http_request_type&& request,
|
||||
boost::asio::ip::tcp::endpoint remote_address)
|
||||
onHandoff(
|
||||
Session& session,
|
||||
std::unique_ptr<stream_type>&& bundle,
|
||||
http_request_type&& request,
|
||||
boost::asio::ip::tcp::endpoint remote_address)
|
||||
{
|
||||
return Handoff{};
|
||||
}
|
||||
|
||||
Handoff
|
||||
onHandoff (Session& session, http_request_type&& request,
|
||||
onHandoff(
|
||||
Session& session,
|
||||
http_request_type&& request,
|
||||
boost::asio::ip::tcp::endpoint remote_address)
|
||||
{
|
||||
return Handoff{};
|
||||
}
|
||||
|
||||
void
|
||||
onRequest (Session& session)
|
||||
onRequest(Session& session)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
onWSMessage(std::shared_ptr<WSSession> session,
|
||||
onWSMessage(
|
||||
std::shared_ptr<WSSession> session,
|
||||
std::vector<boost::asio::const_buffer> const& buffers)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
onClose (Session& session,
|
||||
boost::system::error_code const&)
|
||||
onClose(Session& session, boost::system::error_code const&)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
onStopped (Server& server)
|
||||
onStopped(Server& server)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
using namespace beast::severities;
|
||||
SuiteJournal journal ("Server_test", *this);
|
||||
SuiteJournal journal("Server_test", *this);
|
||||
|
||||
NullHandler h;
|
||||
for(int i = 0; i < 1000; ++i)
|
||||
for (int i = 0; i < 1000; ++i)
|
||||
{
|
||||
TestThread thread;
|
||||
auto s = make_Server(h,
|
||||
thread.get_io_service(), journal);
|
||||
auto s = make_Server(h, thread.get_io_service(), journal);
|
||||
std::vector<Port> serverPort(1);
|
||||
serverPort.back().ip =
|
||||
beast::IP::Address::from_string (getEnvLocalhostAddr()),
|
||||
beast::IP::Address::from_string(getEnvLocalhostAddr()),
|
||||
serverPort.back().port = 0;
|
||||
serverPort.back().protocol.insert("http");
|
||||
s->ports (serverPort);
|
||||
s->ports(serverPort);
|
||||
}
|
||||
pass();
|
||||
}
|
||||
@@ -376,16 +381,18 @@ public:
|
||||
class CaptureSink : public beast::Journal::Sink
|
||||
{
|
||||
std::stringstream& strm_;
|
||||
|
||||
public:
|
||||
CaptureSink(beast::severities::Severity threshold,
|
||||
CaptureSink(
|
||||
beast::severities::Severity threshold,
|
||||
std::stringstream& strm)
|
||||
: beast::Journal::Sink(threshold, false)
|
||||
, strm_(strm)
|
||||
: beast::Journal::Sink(threshold, false), strm_(strm)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
write(beast::severities::Severity level, std::string const& text) override
|
||||
write(beast::severities::Severity level, std::string const& text)
|
||||
override
|
||||
{
|
||||
strm_ << text;
|
||||
}
|
||||
@@ -404,8 +411,7 @@ public:
|
||||
|
||||
public:
|
||||
explicit CaptureLogs(std::string& result)
|
||||
: Logs (beast::severities::kInfo)
|
||||
, result_(result)
|
||||
: Logs(beast::severities::kInfo), result_(result)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -415,7 +421,8 @@ public:
|
||||
}
|
||||
|
||||
std::unique_ptr<beast::Journal::Sink>
|
||||
makeSink(std::string const& partition,
|
||||
makeSink(
|
||||
std::string const& partition,
|
||||
beast::severities::Severity threshold) override
|
||||
{
|
||||
return std::make_unique<CaptureSink>(threshold, strm_);
|
||||
@@ -423,29 +430,28 @@ public:
|
||||
};
|
||||
|
||||
void
|
||||
testBadConfig ()
|
||||
testBadConfig()
|
||||
{
|
||||
testcase ("Server config - invalid options");
|
||||
testcase("Server config - invalid options");
|
||||
using namespace test::jtx;
|
||||
|
||||
std::string messages;
|
||||
|
||||
except ([&]
|
||||
{
|
||||
Env env {*this,
|
||||
except([&] {
|
||||
Env env{
|
||||
*this,
|
||||
envconfig([](std::unique_ptr<Config> cfg) {
|
||||
(*cfg).deprecatedClearSection("port_rpc");
|
||||
return cfg;
|
||||
}),
|
||||
std::make_unique<CaptureLogs>(messages)};
|
||||
});
|
||||
BEAST_EXPECT (
|
||||
messages.find ("Missing 'ip' in [port_rpc]")
|
||||
!= std::string::npos);
|
||||
BEAST_EXPECT(
|
||||
messages.find("Missing 'ip' in [port_rpc]") != std::string::npos);
|
||||
|
||||
except ([&]
|
||||
{
|
||||
Env env {*this,
|
||||
except([&] {
|
||||
Env env{
|
||||
*this,
|
||||
envconfig([](std::unique_ptr<Config> cfg) {
|
||||
(*cfg).deprecatedClearSection("port_rpc");
|
||||
(*cfg)["port_rpc"].set("ip", getEnvLocalhostAddr());
|
||||
@@ -453,13 +459,12 @@ public:
|
||||
}),
|
||||
std::make_unique<CaptureLogs>(messages)};
|
||||
});
|
||||
BEAST_EXPECT (
|
||||
messages.find ("Missing 'port' in [port_rpc]")
|
||||
!= std::string::npos);
|
||||
BEAST_EXPECT(
|
||||
messages.find("Missing 'port' in [port_rpc]") != std::string::npos);
|
||||
|
||||
except ([&]
|
||||
{
|
||||
Env env {*this,
|
||||
except([&] {
|
||||
Env env{
|
||||
*this,
|
||||
envconfig([](std::unique_ptr<Config> cfg) {
|
||||
(*cfg).deprecatedClearSection("port_rpc");
|
||||
(*cfg)["port_rpc"].set("ip", getEnvLocalhostAddr());
|
||||
@@ -468,13 +473,13 @@ public:
|
||||
}),
|
||||
std::make_unique<CaptureLogs>(messages)};
|
||||
});
|
||||
BEAST_EXPECT (
|
||||
messages.find ("Invalid value '0' for key 'port' in [port_rpc]")
|
||||
!= std::string::npos);
|
||||
BEAST_EXPECT(
|
||||
messages.find("Invalid value '0' for key 'port' in [port_rpc]") !=
|
||||
std::string::npos);
|
||||
|
||||
except ([&]
|
||||
{
|
||||
Env env {*this,
|
||||
except([&] {
|
||||
Env env{
|
||||
*this,
|
||||
envconfig([](std::unique_ptr<Config> cfg) {
|
||||
(*cfg).deprecatedClearSection("port_rpc");
|
||||
(*cfg)["port_rpc"].set("ip", getEnvLocalhostAddr());
|
||||
@@ -484,64 +489,69 @@ public:
|
||||
}),
|
||||
std::make_unique<CaptureLogs>(messages)};
|
||||
});
|
||||
BEAST_EXPECT (
|
||||
messages.find ("Missing 'protocol' in [port_rpc]")
|
||||
!= std::string::npos);
|
||||
BEAST_EXPECT(
|
||||
messages.find("Missing 'protocol' in [port_rpc]") !=
|
||||
std::string::npos);
|
||||
|
||||
except ([&] //this creates a standard test config without the server
|
||||
//section
|
||||
{
|
||||
Env env {*this,
|
||||
envconfig([](std::unique_ptr<Config> cfg) {
|
||||
cfg = std::make_unique<Config>();
|
||||
cfg->overwrite (
|
||||
ConfigSection::nodeDatabase (), "type", "memory");
|
||||
cfg->overwrite (
|
||||
ConfigSection::nodeDatabase (), "path", "main");
|
||||
cfg->deprecatedClearSection (
|
||||
ConfigSection::importNodeDatabase ());
|
||||
cfg->legacy("database_path", "");
|
||||
cfg->setupControl(true, true, true);
|
||||
(*cfg)["port_peer"].set("ip", getEnvLocalhostAddr());
|
||||
(*cfg)["port_peer"].set("port", "8080");
|
||||
(*cfg)["port_peer"].set("protocol", "peer");
|
||||
(*cfg)["port_rpc"].set("ip", getEnvLocalhostAddr());
|
||||
(*cfg)["port_rpc"].set("port", "8081");
|
||||
(*cfg)["port_rpc"].set("protocol", "http,ws2");
|
||||
(*cfg)["port_rpc"].set("admin", getEnvLocalhostAddr());
|
||||
(*cfg)["port_ws"].set("ip", getEnvLocalhostAddr());
|
||||
(*cfg)["port_ws"].set("port", "8082");
|
||||
(*cfg)["port_ws"].set("protocol", "ws");
|
||||
(*cfg)["port_ws"].set("admin", getEnvLocalhostAddr());
|
||||
return cfg;
|
||||
}),
|
||||
std::make_unique<CaptureLogs>(messages)};
|
||||
});
|
||||
BEAST_EXPECT (
|
||||
messages.find ("Required section [server] is missing")
|
||||
!= std::string::npos);
|
||||
except(
|
||||
[&] // this creates a standard test config without the server
|
||||
// section
|
||||
{
|
||||
Env env{
|
||||
*this,
|
||||
envconfig([](std::unique_ptr<Config> cfg) {
|
||||
cfg = std::make_unique<Config>();
|
||||
cfg->overwrite(
|
||||
ConfigSection::nodeDatabase(), "type", "memory");
|
||||
cfg->overwrite(
|
||||
ConfigSection::nodeDatabase(), "path", "main");
|
||||
cfg->deprecatedClearSection(
|
||||
ConfigSection::importNodeDatabase());
|
||||
cfg->legacy("database_path", "");
|
||||
cfg->setupControl(true, true, true);
|
||||
(*cfg)["port_peer"].set("ip", getEnvLocalhostAddr());
|
||||
(*cfg)["port_peer"].set("port", "8080");
|
||||
(*cfg)["port_peer"].set("protocol", "peer");
|
||||
(*cfg)["port_rpc"].set("ip", getEnvLocalhostAddr());
|
||||
(*cfg)["port_rpc"].set("port", "8081");
|
||||
(*cfg)["port_rpc"].set("protocol", "http,ws2");
|
||||
(*cfg)["port_rpc"].set("admin", getEnvLocalhostAddr());
|
||||
(*cfg)["port_ws"].set("ip", getEnvLocalhostAddr());
|
||||
(*cfg)["port_ws"].set("port", "8082");
|
||||
(*cfg)["port_ws"].set("protocol", "ws");
|
||||
(*cfg)["port_ws"].set("admin", getEnvLocalhostAddr());
|
||||
return cfg;
|
||||
}),
|
||||
std::make_unique<CaptureLogs>(messages)};
|
||||
});
|
||||
BEAST_EXPECT(
|
||||
messages.find("Required section [server] is missing") !=
|
||||
std::string::npos);
|
||||
|
||||
except ([&] //this creates a standard test config without some of the
|
||||
//port sections
|
||||
{
|
||||
Env env {*this,
|
||||
envconfig([](std::unique_ptr<Config> cfg) {
|
||||
cfg = std::make_unique<Config>();
|
||||
cfg->overwrite (ConfigSection::nodeDatabase (), "type", "memory");
|
||||
cfg->overwrite (ConfigSection::nodeDatabase (), "path", "main");
|
||||
cfg->deprecatedClearSection (ConfigSection::importNodeDatabase ());
|
||||
cfg->legacy("database_path", "");
|
||||
cfg->setupControl(true, true, true);
|
||||
(*cfg)["server"].append("port_peer");
|
||||
(*cfg)["server"].append("port_rpc");
|
||||
(*cfg)["server"].append("port_ws");
|
||||
return cfg;
|
||||
}),
|
||||
std::make_unique<CaptureLogs>(messages)};
|
||||
});
|
||||
BEAST_EXPECT (
|
||||
messages.find ("Missing section: [port_peer]")
|
||||
!= std::string::npos);
|
||||
except([&] // this creates a standard test config without some of the
|
||||
// port sections
|
||||
{
|
||||
Env env{
|
||||
*this,
|
||||
envconfig([](std::unique_ptr<Config> cfg) {
|
||||
cfg = std::make_unique<Config>();
|
||||
cfg->overwrite(
|
||||
ConfigSection::nodeDatabase(), "type", "memory");
|
||||
cfg->overwrite(
|
||||
ConfigSection::nodeDatabase(), "path", "main");
|
||||
cfg->deprecatedClearSection(
|
||||
ConfigSection::importNodeDatabase());
|
||||
cfg->legacy("database_path", "");
|
||||
cfg->setupControl(true, true, true);
|
||||
(*cfg)["server"].append("port_peer");
|
||||
(*cfg)["server"].append("port_rpc");
|
||||
(*cfg)["server"].append("port_ws");
|
||||
return cfg;
|
||||
}),
|
||||
std::make_unique<CaptureLogs>(messages)};
|
||||
});
|
||||
BEAST_EXPECT(
|
||||
messages.find("Missing section: [port_peer]") != std::string::npos);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -553,8 +563,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
BEAST_DEFINE_TESTSUITE(Server,http,ripple);
|
||||
|
||||
} // test
|
||||
} // ripple
|
||||
BEAST_DEFINE_TESTSUITE(Server, http, ripple);
|
||||
|
||||
} // namespace test
|
||||
} // namespace ripple
|
||||
|
||||
Reference in New Issue
Block a user