mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-06 10:16:45 +00:00
chore: Set ColumnLimit to 120 in clang-format (#6288)
This change updates the ColumnLimit from 80 to 120, and applies clang-format to reformat the code.
This commit is contained in:
@@ -100,10 +100,8 @@ r.ripple.com 51235
|
||||
backend=sqlite
|
||||
)xrpldConfig");
|
||||
|
||||
std::string dbPathSection =
|
||||
dbPath.empty() ? "" : "[database_path]\n" + dbPath;
|
||||
std::string valFileSection =
|
||||
validatorsFile.empty() ? "" : "[validators_file]\n" + validatorsFile;
|
||||
std::string dbPathSection = dbPath.empty() ? "" : "[database_path]\n" + dbPath;
|
||||
std::string valFileSection = validatorsFile.empty() ? "" : "[validators_file]\n" + validatorsFile;
|
||||
return boost::str(configContentsTemplate % dbPathSection % valFileSection);
|
||||
}
|
||||
|
||||
@@ -132,9 +130,7 @@ public:
|
||||
test,
|
||||
std::move(subDir),
|
||||
configFile,
|
||||
confContents.empty()
|
||||
? configContents(dbPath.string(), validatorsFile.string())
|
||||
: confContents,
|
||||
confContents.empty() ? configContents(dbPath.string(), validatorsFile.string()) : confContents,
|
||||
useCounter)
|
||||
, dataDir_(dbPath)
|
||||
{
|
||||
@@ -233,9 +229,7 @@ public:
|
||||
: FileDirGuard(
|
||||
test,
|
||||
std::move(subDir),
|
||||
path(
|
||||
validatorsFileName.empty() ? Config::validatorsFileName
|
||||
: validatorsFileName),
|
||||
path(validatorsFileName.empty() ? Config::validatorsFileName : validatorsFileName),
|
||||
valFileContents(),
|
||||
useCounter)
|
||||
{
|
||||
@@ -301,8 +295,7 @@ port_wss_admin
|
||||
auto const cwd = current_path();
|
||||
|
||||
// Test both config file names.
|
||||
char const* configFiles[] = {
|
||||
Config::configFileName, Config::configLegacyName};
|
||||
char const* configFiles[] = {Config::configFileName, Config::configLegacyName};
|
||||
|
||||
// Config file in current directory.
|
||||
for (auto const& configFile : configFiles)
|
||||
@@ -319,9 +312,7 @@ port_wss_admin
|
||||
Config c;
|
||||
c.setup("", true, false, true);
|
||||
BEAST_EXPECT(c.section(SECTION_DEBUG_LOGFILE).values().size() == 1);
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_DEBUG_LOGFILE).values()[0] ==
|
||||
"/Users/dummy/xrpld/config/log/debug.log");
|
||||
BEAST_EXPECT(c.section(SECTION_DEBUG_LOGFILE).values()[0] == "/Users/dummy/xrpld/config/log/debug.log");
|
||||
}
|
||||
|
||||
// Config file in HOME or XDG_CONFIG_HOME directory.
|
||||
@@ -357,16 +348,12 @@ port_wss_admin
|
||||
// Load the config file from the config directory and verify it.
|
||||
Config c;
|
||||
c.setup("", true, false, true);
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_DEBUG_LOGFILE).values().size() == 1);
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_DEBUG_LOGFILE).values()[0] ==
|
||||
"/Users/dummy/xrpld/config/log/debug.log");
|
||||
BEAST_EXPECT(c.section(SECTION_DEBUG_LOGFILE).values().size() == 1);
|
||||
BEAST_EXPECT(c.section(SECTION_DEBUG_LOGFILE).values()[0] == "/Users/dummy/xrpld/config/log/debug.log");
|
||||
|
||||
// Restore the environment variables.
|
||||
h ? setenv("HOME", h, 1) : unsetenv("HOME");
|
||||
x ? setenv("XDG_CONFIG_HOME", x, 1)
|
||||
: unsetenv("XDG_CONFIG_HOME");
|
||||
x ? setenv("XDG_CONFIG_HOME", x, 1) : unsetenv("XDG_CONFIG_HOME");
|
||||
}
|
||||
|
||||
// The XDG config directory is not set: the config file must be in a
|
||||
@@ -395,11 +382,8 @@ port_wss_admin
|
||||
// Load the config file from the config directory and verify it.
|
||||
Config c;
|
||||
c.setup("", true, false, true);
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_DEBUG_LOGFILE).values().size() == 1);
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_DEBUG_LOGFILE).values()[0] ==
|
||||
"/Users/dummy/xrpld/config/log/debug.log");
|
||||
BEAST_EXPECT(c.section(SECTION_DEBUG_LOGFILE).values().size() == 1);
|
||||
BEAST_EXPECT(c.section(SECTION_DEBUG_LOGFILE).values()[0] == "/Users/dummy/xrpld/config/log/debug.log");
|
||||
|
||||
// Restore the environment variables.
|
||||
h ? setenv("HOME", h, 1) : unsetenv("HOME");
|
||||
@@ -451,13 +435,7 @@ port_wss_admin
|
||||
detail::DirGuard const g0(*this, "test_db");
|
||||
path const dataDirRel("test_data_dir");
|
||||
path const dataDirAbs(cwd / g0.subdir() / dataDirRel);
|
||||
detail::FileCfgGuard const g(
|
||||
*this,
|
||||
g0.subdir(),
|
||||
dataDirAbs,
|
||||
Config::configFileName,
|
||||
"",
|
||||
false);
|
||||
detail::FileCfgGuard const g(*this, g0.subdir(), dataDirAbs, Config::configFileName, "", false);
|
||||
auto const& c(g.config());
|
||||
BEAST_EXPECT(g.dataDirExists());
|
||||
BEAST_EXPECT(g.configFileExists());
|
||||
@@ -466,8 +444,7 @@ port_wss_admin
|
||||
{
|
||||
// read from file relative path
|
||||
std::string const dbPath("my_db");
|
||||
detail::FileCfgGuard const g(
|
||||
*this, "test_db", dbPath, Config::configFileName, "");
|
||||
detail::FileCfgGuard const g(*this, "test_db", dbPath, Config::configFileName, "");
|
||||
auto const& c(g.config());
|
||||
std::string const nativeDbPath = absolute(path(dbPath)).string();
|
||||
BEAST_EXPECT(g.dataDirExists());
|
||||
@@ -476,11 +453,9 @@ port_wss_admin
|
||||
}
|
||||
{
|
||||
// read from file no path
|
||||
detail::FileCfgGuard const g(
|
||||
*this, "test_db", "", Config::configFileName, "");
|
||||
detail::FileCfgGuard const g(*this, "test_db", "", Config::configFileName, "");
|
||||
auto const& c(g.config());
|
||||
std::string const nativeDbPath =
|
||||
absolute(g.subdir() / path(Config::databaseDirName)).string();
|
||||
std::string const nativeDbPath = absolute(g.subdir() / path(Config::databaseDirName)).string();
|
||||
BEAST_EXPECT(g.dataDirExists());
|
||||
BEAST_EXPECT(g.configFileExists());
|
||||
BEAST_EXPECT(c.legacy("database_path") == nativeDbPath);
|
||||
@@ -520,8 +495,7 @@ port_wss_admin
|
||||
"and [validator_token] config sections";
|
||||
try
|
||||
{
|
||||
c.loadFromString(
|
||||
boost::str(configTemplate % validationSeed % token));
|
||||
c.loadFromString(boost::str(configTemplate % validationSeed % token));
|
||||
}
|
||||
catch (std::runtime_error& e)
|
||||
{
|
||||
@@ -607,9 +581,7 @@ main
|
||||
boost::format cc("[validators_file]\n%1%\n");
|
||||
std::string error;
|
||||
std::string const missingPath = "/no/way/this/path/exists";
|
||||
auto const expectedError =
|
||||
"The file specified in [validators_file] does not exist: " +
|
||||
missingPath;
|
||||
auto const expectedError = "The file specified in [validators_file] does not exist: " + missingPath;
|
||||
try
|
||||
{
|
||||
Config c;
|
||||
@@ -623,14 +595,11 @@ main
|
||||
}
|
||||
{
|
||||
// load should throw for invalid [validators_file]
|
||||
detail::ValidatorsTxtGuard const vtg(
|
||||
*this, "test_cfg", "validators.cfg");
|
||||
detail::ValidatorsTxtGuard const vtg(*this, "test_cfg", "validators.cfg");
|
||||
path const invalidFile = current_path() / vtg.subdir();
|
||||
boost::format cc("[validators_file]\n%1%\n");
|
||||
std::string error;
|
||||
auto const expectedError =
|
||||
"Invalid file specified in [validators_file]: " +
|
||||
invalidFile.string();
|
||||
auto const expectedError = "Invalid file specified in [validators_file]: " + invalidFile.string();
|
||||
try
|
||||
{
|
||||
Config c;
|
||||
@@ -675,25 +644,16 @@ trustthesevalidators.gov
|
||||
1
|
||||
)xrpldConfig");
|
||||
c.loadFromString(toLoad);
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_VALIDATOR_LIST_SITES).values().size() == 2);
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_VALIDATOR_LIST_SITES).values()[0] ==
|
||||
"xrplvalidators.com");
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_VALIDATOR_LIST_SITES).values()[1] ==
|
||||
"trustthesevalidators.gov");
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_VALIDATOR_LIST_KEYS).values().size() == 1);
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_SITES).values().size() == 2);
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_SITES).values()[0] == "xrplvalidators.com");
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_SITES).values()[1] == "trustthesevalidators.gov");
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_KEYS).values().size() == 1);
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_VALIDATOR_LIST_KEYS).values()[0] ==
|
||||
"021A99A537FDEBC34E4FCA03B39BEADD04299BB19E85097EC92B15A3518801"
|
||||
"E566");
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_VALIDATOR_LIST_THRESHOLD).values().size() ==
|
||||
1);
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_VALIDATOR_LIST_THRESHOLD).values()[0] == "1");
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_THRESHOLD).values().size() == 1);
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_THRESHOLD).values()[0] == "1");
|
||||
BEAST_EXPECT(c.VALIDATOR_LIST_THRESHOLD == std::size_t(1));
|
||||
}
|
||||
{
|
||||
@@ -711,25 +671,16 @@ trustthesevalidators.gov
|
||||
0
|
||||
)xrpldConfig");
|
||||
c.loadFromString(toLoad);
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_VALIDATOR_LIST_SITES).values().size() == 2);
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_VALIDATOR_LIST_SITES).values()[0] ==
|
||||
"xrplvalidators.com");
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_VALIDATOR_LIST_SITES).values()[1] ==
|
||||
"trustthesevalidators.gov");
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_VALIDATOR_LIST_KEYS).values().size() == 1);
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_SITES).values().size() == 2);
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_SITES).values()[0] == "xrplvalidators.com");
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_SITES).values()[1] == "trustthesevalidators.gov");
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_KEYS).values().size() == 1);
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_VALIDATOR_LIST_KEYS).values()[0] ==
|
||||
"021A99A537FDEBC34E4FCA03B39BEADD04299BB19E85097EC92B15A3518801"
|
||||
"E566");
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_VALIDATOR_LIST_THRESHOLD).values().size() ==
|
||||
1);
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_VALIDATOR_LIST_THRESHOLD).values()[0] == "0");
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_THRESHOLD).values().size() == 1);
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_THRESHOLD).values()[0] == "0");
|
||||
BEAST_EXPECT(c.VALIDATOR_LIST_THRESHOLD == std::nullopt);
|
||||
}
|
||||
{
|
||||
@@ -827,8 +778,7 @@ xrplvalidators.com
|
||||
trustthesevalidators.gov
|
||||
)xrpldConfig");
|
||||
std::string error;
|
||||
auto const expectedError =
|
||||
"[validator_list_keys] config section is missing";
|
||||
auto const expectedError = "[validator_list_keys] config section is missing";
|
||||
try
|
||||
{
|
||||
c.loadFromString(toLoad);
|
||||
@@ -842,124 +792,80 @@ trustthesevalidators.gov
|
||||
}
|
||||
{
|
||||
// load from specified [validators_file] absolute path
|
||||
detail::ValidatorsTxtGuard const vtg(
|
||||
*this, "test_cfg", "validators.cfg");
|
||||
detail::ValidatorsTxtGuard const vtg(*this, "test_cfg", "validators.cfg");
|
||||
BEAST_EXPECT(vtg.validatorsFileExists());
|
||||
Config c;
|
||||
boost::format cc("[validators_file]\n%1%\n");
|
||||
c.loadFromString(boost::str(cc % vtg.validatorsFile()));
|
||||
BEAST_EXPECT(c.legacy("validators_file") == vtg.validatorsFile());
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATORS).values().size() == 8);
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_VALIDATOR_LIST_SITES).values().size() == 2);
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_VALIDATOR_LIST_KEYS).values().size() == 2);
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_VALIDATOR_LIST_THRESHOLD).values().size() ==
|
||||
1);
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_SITES).values().size() == 2);
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_KEYS).values().size() == 2);
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_THRESHOLD).values().size() == 1);
|
||||
BEAST_EXPECT(c.VALIDATOR_LIST_THRESHOLD == 2);
|
||||
}
|
||||
{
|
||||
// load from specified [validators_file] file name
|
||||
// in config directory
|
||||
std::string const valFileName = "validators.txt";
|
||||
detail::ValidatorsTxtGuard const vtg(
|
||||
*this, "test_cfg", valFileName);
|
||||
detail::FileCfgGuard const rcg(
|
||||
*this,
|
||||
vtg.subdir(),
|
||||
"",
|
||||
Config::configFileName,
|
||||
valFileName,
|
||||
false);
|
||||
detail::ValidatorsTxtGuard const vtg(*this, "test_cfg", valFileName);
|
||||
detail::FileCfgGuard const rcg(*this, vtg.subdir(), "", Config::configFileName, valFileName, false);
|
||||
BEAST_EXPECT(vtg.validatorsFileExists());
|
||||
BEAST_EXPECT(rcg.configFileExists());
|
||||
auto const& c(rcg.config());
|
||||
BEAST_EXPECT(c.legacy("validators_file") == valFileName);
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATORS).values().size() == 8);
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_VALIDATOR_LIST_SITES).values().size() == 2);
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_VALIDATOR_LIST_KEYS).values().size() == 2);
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_VALIDATOR_LIST_THRESHOLD).values().size() ==
|
||||
1);
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_SITES).values().size() == 2);
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_KEYS).values().size() == 2);
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_THRESHOLD).values().size() == 1);
|
||||
BEAST_EXPECT(c.VALIDATOR_LIST_THRESHOLD == 2);
|
||||
}
|
||||
{
|
||||
// load from specified [validators_file] relative path
|
||||
// to config directory
|
||||
detail::ValidatorsTxtGuard const vtg(
|
||||
*this, "test_cfg", "validators.txt");
|
||||
detail::ValidatorsTxtGuard const vtg(*this, "test_cfg", "validators.txt");
|
||||
auto const valFilePath = ".." / vtg.subdir() / "validators.txt";
|
||||
detail::FileCfgGuard const rcg(
|
||||
*this,
|
||||
vtg.subdir(),
|
||||
"",
|
||||
Config::configFileName,
|
||||
valFilePath,
|
||||
false);
|
||||
detail::FileCfgGuard const rcg(*this, vtg.subdir(), "", Config::configFileName, valFilePath, false);
|
||||
BEAST_EXPECT(vtg.validatorsFileExists());
|
||||
BEAST_EXPECT(rcg.configFileExists());
|
||||
auto const& c(rcg.config());
|
||||
BEAST_EXPECT(c.legacy("validators_file") == valFilePath);
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATORS).values().size() == 8);
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_VALIDATOR_LIST_SITES).values().size() == 2);
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_VALIDATOR_LIST_KEYS).values().size() == 2);
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_VALIDATOR_LIST_THRESHOLD).values().size() ==
|
||||
1);
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_SITES).values().size() == 2);
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_KEYS).values().size() == 2);
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_THRESHOLD).values().size() == 1);
|
||||
BEAST_EXPECT(c.VALIDATOR_LIST_THRESHOLD == 2);
|
||||
}
|
||||
{
|
||||
// load from validators file in default location
|
||||
detail::ValidatorsTxtGuard const vtg(
|
||||
*this, "test_cfg", "validators.txt");
|
||||
detail::FileCfgGuard const rcg(
|
||||
*this, vtg.subdir(), "", Config::configFileName, "", false);
|
||||
detail::ValidatorsTxtGuard const vtg(*this, "test_cfg", "validators.txt");
|
||||
detail::FileCfgGuard const rcg(*this, vtg.subdir(), "", Config::configFileName, "", false);
|
||||
BEAST_EXPECT(vtg.validatorsFileExists());
|
||||
BEAST_EXPECT(rcg.configFileExists());
|
||||
auto const& c(rcg.config());
|
||||
BEAST_EXPECT(c.legacy("validators_file").empty());
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATORS).values().size() == 8);
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_VALIDATOR_LIST_SITES).values().size() == 2);
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_VALIDATOR_LIST_KEYS).values().size() == 2);
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_VALIDATOR_LIST_THRESHOLD).values().size() ==
|
||||
1);
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_SITES).values().size() == 2);
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_KEYS).values().size() == 2);
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_THRESHOLD).values().size() == 1);
|
||||
BEAST_EXPECT(c.VALIDATOR_LIST_THRESHOLD == 2);
|
||||
}
|
||||
{
|
||||
// load from specified [validators_file] instead
|
||||
// of default location
|
||||
detail::ValidatorsTxtGuard const vtg(
|
||||
*this, "test_cfg", "validators.cfg");
|
||||
detail::ValidatorsTxtGuard const vtg(*this, "test_cfg", "validators.cfg");
|
||||
BEAST_EXPECT(vtg.validatorsFileExists());
|
||||
detail::ValidatorsTxtGuard const vtgDefault(
|
||||
*this, vtg.subdir(), "validators.txt", false);
|
||||
detail::ValidatorsTxtGuard const vtgDefault(*this, vtg.subdir(), "validators.txt", false);
|
||||
BEAST_EXPECT(vtgDefault.validatorsFileExists());
|
||||
detail::FileCfgGuard const rcg(
|
||||
*this,
|
||||
vtg.subdir(),
|
||||
"",
|
||||
Config::configFileName,
|
||||
vtg.validatorsFile(),
|
||||
false);
|
||||
*this, vtg.subdir(), "", Config::configFileName, vtg.validatorsFile(), false);
|
||||
BEAST_EXPECT(rcg.configFileExists());
|
||||
auto const& c(rcg.config());
|
||||
BEAST_EXPECT(c.legacy("validators_file") == vtg.validatorsFile());
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATORS).values().size() == 8);
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_VALIDATOR_LIST_SITES).values().size() == 2);
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_VALIDATOR_LIST_KEYS).values().size() == 2);
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_VALIDATOR_LIST_THRESHOLD).values().size() ==
|
||||
1);
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_SITES).values().size() == 2);
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_KEYS).values().size() == 2);
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_THRESHOLD).values().size() == 1);
|
||||
BEAST_EXPECT(c.VALIDATOR_LIST_THRESHOLD == 2);
|
||||
}
|
||||
|
||||
@@ -987,20 +893,15 @@ trustthesevalidators.gov
|
||||
[validator_list_keys]
|
||||
021A99A537FDEBC34E4FCA03B39BEADD04299BB19E85097EC92B15A3518801E566
|
||||
)xrpldConfig");
|
||||
detail::ValidatorsTxtGuard const vtg(
|
||||
*this, "test_cfg", "validators.cfg");
|
||||
detail::ValidatorsTxtGuard const vtg(*this, "test_cfg", "validators.cfg");
|
||||
BEAST_EXPECT(vtg.validatorsFileExists());
|
||||
Config c;
|
||||
c.loadFromString(boost::str(cc % vtg.validatorsFile()));
|
||||
BEAST_EXPECT(c.legacy("validators_file") == vtg.validatorsFile());
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATORS).values().size() == 15);
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_VALIDATOR_LIST_SITES).values().size() == 4);
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_VALIDATOR_LIST_KEYS).values().size() == 3);
|
||||
BEAST_EXPECT(
|
||||
c.section(SECTION_VALIDATOR_LIST_THRESHOLD).values().size() ==
|
||||
1);
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_SITES).values().size() == 4);
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_KEYS).values().size() == 3);
|
||||
BEAST_EXPECT(c.section(SECTION_VALIDATOR_LIST_THRESHOLD).values().size() == 1);
|
||||
BEAST_EXPECT(c.VALIDATOR_LIST_THRESHOLD == 2);
|
||||
}
|
||||
{
|
||||
@@ -1014,8 +915,7 @@ trustthesevalidators.gov
|
||||
1
|
||||
)xrpldConfig");
|
||||
std::string error;
|
||||
detail::ValidatorsTxtGuard const vtg(
|
||||
*this, "test_cfg", "validators.cfg");
|
||||
detail::ValidatorsTxtGuard const vtg(*this, "test_cfg", "validators.cfg");
|
||||
BEAST_EXPECT(vtg.validatorsFileExists());
|
||||
auto const expectedError =
|
||||
"Config section [validator_list_threshold] should contain "
|
||||
@@ -1039,8 +939,7 @@ trustthesevalidators.gov
|
||||
Config c;
|
||||
boost::format cc("[validators_file]\n%1%\n");
|
||||
std::string error;
|
||||
detail::ValidatorsTxtGuard const vtg(
|
||||
*this, "test_cfg", "validators.cfg");
|
||||
detail::ValidatorsTxtGuard const vtg(*this, "test_cfg", "validators.cfg");
|
||||
BEAST_EXPECT(vtg.validatorsFileExists());
|
||||
auto const expectedError =
|
||||
"The file specified in [validators_file] does not contain a "
|
||||
@@ -1064,12 +963,7 @@ trustthesevalidators.gov
|
||||
void
|
||||
testSetup(bool explicitPath)
|
||||
{
|
||||
detail::FileCfgGuard const cfg(
|
||||
*this,
|
||||
"testSetup",
|
||||
explicitPath ? "test_db" : "",
|
||||
Config::configFileName,
|
||||
"");
|
||||
detail::FileCfgGuard const cfg(*this, "testSetup", explicitPath ? "test_db" : "", Config::configFileName, "");
|
||||
/* FileCfgGuard has a Config object that gets loaded on
|
||||
construction, but Config::setup is not reentrant, so we
|
||||
need a fresh config for every test case, so ignore it.
|
||||
@@ -1137,8 +1031,7 @@ trustthesevalidators.gov
|
||||
BEAST_EXPECT(!config.silent());
|
||||
BEAST_EXPECT(config.standalone());
|
||||
BEAST_EXPECT(config.LEDGER_HISTORY == 0);
|
||||
BEAST_EXPECT(
|
||||
config.legacy("database_path").empty() == !explicitPath);
|
||||
BEAST_EXPECT(config.legacy("database_path").empty() == !explicitPath);
|
||||
}
|
||||
{
|
||||
Config config;
|
||||
@@ -1151,8 +1044,7 @@ trustthesevalidators.gov
|
||||
BEAST_EXPECT(!config.silent());
|
||||
BEAST_EXPECT(config.standalone());
|
||||
BEAST_EXPECT(config.LEDGER_HISTORY == 0);
|
||||
BEAST_EXPECT(
|
||||
config.legacy("database_path").empty() == !explicitPath);
|
||||
BEAST_EXPECT(config.legacy("database_path").empty() == !explicitPath);
|
||||
}
|
||||
{
|
||||
Config config;
|
||||
@@ -1165,8 +1057,7 @@ trustthesevalidators.gov
|
||||
BEAST_EXPECT(config.silent());
|
||||
BEAST_EXPECT(config.standalone());
|
||||
BEAST_EXPECT(config.LEDGER_HISTORY == 0);
|
||||
BEAST_EXPECT(
|
||||
config.legacy("database_path").empty() == !explicitPath);
|
||||
BEAST_EXPECT(config.legacy("database_path").empty() == !explicitPath);
|
||||
}
|
||||
{
|
||||
Config config;
|
||||
@@ -1179,16 +1070,14 @@ trustthesevalidators.gov
|
||||
BEAST_EXPECT(config.silent());
|
||||
BEAST_EXPECT(config.standalone());
|
||||
BEAST_EXPECT(config.LEDGER_HISTORY == 0);
|
||||
BEAST_EXPECT(
|
||||
config.legacy("database_path").empty() == !explicitPath);
|
||||
BEAST_EXPECT(config.legacy("database_path").empty() == !explicitPath);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
testPort()
|
||||
{
|
||||
detail::FileCfgGuard const cfg(
|
||||
*this, "testPort", "", Config::configFileName, "");
|
||||
detail::FileCfgGuard const cfg(*this, "testPort", "", Config::configFileName, "");
|
||||
auto const& conf = cfg.config();
|
||||
if (!BEAST_EXPECT(conf.exists("port_rpc")))
|
||||
return;
|
||||
@@ -1207,27 +1096,17 @@ trustthesevalidators.gov
|
||||
void
|
||||
testZeroPort()
|
||||
{
|
||||
auto const contents = std::regex_replace(
|
||||
detail::configContents("", ""),
|
||||
std::regex("port\\s*=\\s*\\d+"),
|
||||
"port = 0");
|
||||
auto const contents =
|
||||
std::regex_replace(detail::configContents("", ""), std::regex("port\\s*=\\s*\\d+"), "port = 0");
|
||||
|
||||
try
|
||||
{
|
||||
detail::FileCfgGuard const cfg(
|
||||
*this,
|
||||
"testPort",
|
||||
"",
|
||||
Config::configFileName,
|
||||
"",
|
||||
true,
|
||||
contents);
|
||||
detail::FileCfgGuard const cfg(*this, "testPort", "", Config::configFileName, "", true, contents);
|
||||
BEAST_EXPECT(false);
|
||||
}
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
BEAST_EXPECT(std::string_view(ex.what()).starts_with(
|
||||
"Invalid value '0' for key 'port'"));
|
||||
BEAST_EXPECT(std::string_view(ex.what()).starts_with("Invalid value '0' for key 'port'"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1264,12 +1143,10 @@ r.ripple.com 51235
|
||||
cfg.exists("port_rpc") && cfg.section("port_rpc").lines().empty() &&
|
||||
cfg.section("port_rpc").values().empty());
|
||||
BEAST_EXPECT(
|
||||
cfg.exists(SECTION_IPS) &&
|
||||
cfg.section(SECTION_IPS).lines().size() == 1 &&
|
||||
cfg.exists(SECTION_IPS) && cfg.section(SECTION_IPS).lines().size() == 1 &&
|
||||
cfg.section(SECTION_IPS).values().size() == 1);
|
||||
BEAST_EXPECT(
|
||||
cfg.exists(SECTION_IPS_FIXED) &&
|
||||
cfg.section(SECTION_IPS_FIXED).lines().size() == 2 &&
|
||||
cfg.exists(SECTION_IPS_FIXED) && cfg.section(SECTION_IPS_FIXED).lines().size() == 2 &&
|
||||
cfg.section(SECTION_IPS_FIXED).values().size() == 2);
|
||||
}
|
||||
|
||||
@@ -1320,12 +1197,10 @@ r.ripple.com:51235
|
||||
cfg.exists("port_rpc") && cfg.section("port_rpc").lines().empty() &&
|
||||
cfg.section("port_rpc").values().empty());
|
||||
BEAST_EXPECT(
|
||||
cfg.exists(SECTION_IPS) &&
|
||||
cfg.section(SECTION_IPS).lines().size() == 1 &&
|
||||
cfg.exists(SECTION_IPS) && cfg.section(SECTION_IPS).lines().size() == 1 &&
|
||||
cfg.section(SECTION_IPS).values().size() == 1);
|
||||
BEAST_EXPECT(
|
||||
cfg.exists(SECTION_IPS_FIXED) &&
|
||||
cfg.section(SECTION_IPS_FIXED).lines().size() == 15 &&
|
||||
cfg.exists(SECTION_IPS_FIXED) && cfg.section(SECTION_IPS_FIXED).lines().size() == 15 &&
|
||||
cfg.section(SECTION_IPS_FIXED).values().size() == 15);
|
||||
BEAST_EXPECT(cfg.IPS[0] == "r.ripple.com 51235");
|
||||
|
||||
@@ -1344,11 +1219,8 @@ r.ripple.com:51235
|
||||
BEAST_EXPECT(cfg.IPS_FIXED[10] == "::1");
|
||||
BEAST_EXPECT(cfg.IPS_FIXED[11] == "::1:12345");
|
||||
BEAST_EXPECT(cfg.IPS_FIXED[12] == "[::1]:12345");
|
||||
BEAST_EXPECT(
|
||||
cfg.IPS_FIXED[13] ==
|
||||
"2001:db8:3333:4444:5555:6666:7777:8888:12345");
|
||||
BEAST_EXPECT(
|
||||
cfg.IPS_FIXED[14] == "[2001:db8:3333:4444:5555:6666:7777:8888]:1");
|
||||
BEAST_EXPECT(cfg.IPS_FIXED[13] == "2001:db8:3333:4444:5555:6666:7777:8888:12345");
|
||||
BEAST_EXPECT(cfg.IPS_FIXED[14] == "[2001:db8:3333:4444:5555:6666:7777:8888]:1");
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1542,8 +1414,7 @@ r.ripple.com:51235
|
||||
{
|
||||
c.loadFromString(toLoad);
|
||||
if (shouldPass)
|
||||
BEAST_EXPECT(
|
||||
c.AMENDMENT_MAJORITY_TIME.count() == val * sec);
|
||||
BEAST_EXPECT(c.AMENDMENT_MAJORITY_TIME.count() == val * sec);
|
||||
else
|
||||
fail();
|
||||
}
|
||||
@@ -1562,8 +1433,7 @@ r.ripple.com:51235
|
||||
{
|
||||
testcase("overlay: unknown time");
|
||||
|
||||
auto testUnknown =
|
||||
[](std::string value) -> std::optional<std::chrono::seconds> {
|
||||
auto testUnknown = [](std::string value) -> std::optional<std::chrono::seconds> {
|
||||
try
|
||||
{
|
||||
Config c;
|
||||
@@ -1597,8 +1467,7 @@ r.ripple.com:51235
|
||||
testcase("overlay: diverged time");
|
||||
|
||||
// In bounds:
|
||||
auto testDiverged =
|
||||
[](std::string value) -> std::optional<std::chrono::seconds> {
|
||||
auto testDiverged = [](std::string value) -> std::optional<std::chrono::seconds> {
|
||||
try
|
||||
{
|
||||
Config c;
|
||||
|
||||
Reference in New Issue
Block a user