mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-10 06:05:49 +00:00
Exercise debugLog writes in jtx unit tests (RIPD-1393)
This commit is contained in:
committed by
Edward Hennis
parent
f5af8b03de
commit
71b42dcec5
@@ -154,6 +154,9 @@ public:
|
||||
Env::AppBundle::AppBundle(beast::unit_test::suite& suite,
|
||||
std::unique_ptr<Config> config)
|
||||
{
|
||||
using namespace beast::severities;
|
||||
// Use kFatal threshold to reduce noise from STObject.
|
||||
setDebugLogSink (std::make_unique<SuiteSink>("Debug", kFatal, suite));
|
||||
auto logs = std::make_unique<SuiteLogs>(suite);
|
||||
auto timeKeeper_ =
|
||||
std::make_unique<ManualTimeKeeper>();
|
||||
@@ -163,7 +166,7 @@ Env::AppBundle::AppBundle(beast::unit_test::suite& suite,
|
||||
owned = make_Application(std::move(config),
|
||||
std::move(logs), std::move(timeKeeper_));
|
||||
app = owned.get();
|
||||
app->logs().threshold(beast::severities::kError);
|
||||
app->logs().threshold(kError);
|
||||
if(! app->setup())
|
||||
Throw<std::runtime_error> ("Env::AppBundle: setup failed");
|
||||
timeKeeper->set(
|
||||
@@ -183,6 +186,9 @@ Env::AppBundle::~AppBundle()
|
||||
app->getJobQueue().rendezvous();
|
||||
app->signalStop();
|
||||
thread.join();
|
||||
|
||||
// Remove the debugLogSink before the suite goes out of scope.
|
||||
setDebugLogSink (nullptr);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <ripple/json/json_reader.h> // Json::Reader
|
||||
#include <ripple/protocol/STParsedJSON.h> // STParsedJSONObject
|
||||
#include <ripple/beast/unit_test.h>
|
||||
#include <test/jtx.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -175,6 +176,9 @@ public:
|
||||
{
|
||||
using namespace InnerObjectFormatsUnitTestDetail;
|
||||
|
||||
// Instantiate a jtx::Env so debugLog writes are exercised.
|
||||
test::jtx::Env env (*this);
|
||||
|
||||
for (auto const& test : testArray)
|
||||
{
|
||||
Json::Value req;
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#include <ripple/json/json_reader.h>
|
||||
#include <ripple/json/to_string.h>
|
||||
#include <ripple/beast/unit_test.h>
|
||||
#include <test/jtx.h>
|
||||
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
|
||||
@@ -501,6 +503,9 @@ public:
|
||||
void
|
||||
run()
|
||||
{
|
||||
// Instantiate a jtx::Env so debugLog writes are exercised.
|
||||
test::jtx::Env env (*this);
|
||||
|
||||
testFields();
|
||||
testSerialization();
|
||||
testParseJSONArray();
|
||||
|
||||
Reference in New Issue
Block a user