mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Add helper to modify Env configs (RIPD-1247)
Add envconfig test helper for manipulating Env config via callables. Create new common modifiers for non-admin config, validator config and one for using different server port values.
This commit is contained in:
committed by
Scott Schurr
parent
09a1d1a593
commit
80d9b0464a
@@ -25,6 +25,7 @@
|
||||
#include <ripple/core/SociDB.h>
|
||||
#include <ripple/protocol/JsonFields.h>
|
||||
#include <test/jtx.h>
|
||||
#include <test/jtx/envconfig.h>
|
||||
|
||||
namespace ripple {
|
||||
namespace test {
|
||||
@@ -34,26 +35,24 @@ class SHAMapStore_test : public beast::unit_test::suite
|
||||
static auto const deleteInterval = 8;
|
||||
|
||||
static
|
||||
std::unique_ptr<Config>
|
||||
makeConfig()
|
||||
auto
|
||||
onlineDelete(std::unique_ptr<Config> cfg)
|
||||
{
|
||||
auto p = std::make_unique<Config>();
|
||||
setupConfigForUnitTests(*p);
|
||||
p->LEDGER_HISTORY = deleteInterval;
|
||||
auto& section = p->section(ConfigSection::nodeDatabase());
|
||||
cfg->LEDGER_HISTORY = deleteInterval;
|
||||
auto& section = cfg->section(ConfigSection::nodeDatabase());
|
||||
section.set("online_delete", to_string(deleteInterval));
|
||||
//section.set("age_threshold", "60");
|
||||
return p;
|
||||
return cfg;
|
||||
}
|
||||
|
||||
static
|
||||
std::unique_ptr<Config>
|
||||
makeConfigAdvisory()
|
||||
auto
|
||||
advisoryDelete(std::unique_ptr<Config> cfg)
|
||||
{
|
||||
auto p = makeConfig();
|
||||
auto& section = p->section(ConfigSection::nodeDatabase());
|
||||
section.set("advisory_delete", "1");
|
||||
return p;
|
||||
cfg = onlineDelete(std::move(cfg));
|
||||
cfg->section(ConfigSection::nodeDatabase())
|
||||
.set("advisory_delete", "1");
|
||||
return cfg;
|
||||
}
|
||||
|
||||
bool goodLedger(jtx::Env& env, Json::Value const& json,
|
||||
@@ -211,7 +210,7 @@ public:
|
||||
testcase("clearPrior");
|
||||
using namespace jtx;
|
||||
|
||||
Env env(*this, makeConfig());
|
||||
Env env(*this, envconfig(onlineDelete));
|
||||
|
||||
auto& store = env.app().getSHAMapStore();
|
||||
env.fund(XRP(10000), noripple("alice"));
|
||||
@@ -397,7 +396,7 @@ public:
|
||||
using namespace jtx;
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
Env env(*this, makeConfig());
|
||||
Env env(*this, envconfig(onlineDelete));
|
||||
auto& store = env.app().getSHAMapStore();
|
||||
|
||||
auto ledgerSeq = waitForReady(env);
|
||||
@@ -466,7 +465,7 @@ public:
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
// Same config with advisory_delete enabled
|
||||
Env env(*this, makeConfigAdvisory());
|
||||
Env env(*this, envconfig(advisoryDelete));
|
||||
auto& store = env.app().getSHAMapStore();
|
||||
|
||||
auto ledgerSeq = waitForReady(env);
|
||||
|
||||
Reference in New Issue
Block a user