20#include <test/jtx/TestSuite.h>
21#include <test/unit_test/FileDirGuard.h>
23#include <xrpld/core/Config.h>
24#include <xrpld/core/ConfigSections.h>
26#include <xrpl/beast/unit_test/suite.h>
27#include <xrpl/server/Port.h>
29#include <boost/filesystem.hpp>
30#include <boost/format.hpp>
40 static boost::format configContentsTemplate(R
"rippleConfig(
68#-------------------------------------------------------------------------------
73# This is primary persistent datastore for rippled. This includes transaction
74# metadata, account states, and ledger headers. Helpful information can be
75# found on https://xrpl.org/capacity-planning.html#node-db-type
76# delete old ledgers while maintaining at least 2000. Do not require an
77# external administrative command to initiate deletion.
80path=/Users/dummy/ripple/config/db/rocksdb
91# This needs to be an absolute directory reference, not a relative one.
92# Modify this value as required.
94/Users/dummy/ripple/config/log/debug.log
102# Where to find some other servers speaking the Ripple protocol.
107# Turn down default logging to save disk space in the long run.
108# Valid values here are trace, debug, info, warning, error, and fatal
110{ "command": "log_level", "severity": "warning" }
112# Defaults to 1 ("yes") so that certificates will be validated. To allow the use
113# of self-signed certificates for development or internal use, set to 0 ("no").
122 dbPath.empty() ? "" :
"[database_path]\n" + dbPath;
124 validatorsFile.
empty() ?
"" :
"[validators_file]\n" + validatorsFile;
125 return boost::str(configContentsTemplate % dbPathSection % valFileSection);
145 path const& validatorsFile,
146 bool useCounter =
true,
178 return file().string();
184 return boost::filesystem::is_directory(
dataDir_);
197 using namespace boost::filesystem;
214n949f75evCHwgyP4fPVgaHqNHxUVN15PsJEZ3B3HnXPcPjcZAoy7
215n9MD5h24qrQqiyBC8aeqqCWvpiBiYQ3jxSr91uiDvmrkyHRdYLUj
216n9L81uNCaPgtUJfaHh89gmdvXKAmSt5Gdsw2g1iPWaPkAHW5Nm4C
217n9KiYM9CgngLvtRCQHZwgC2gjpdaZcCcbt3VboxiNFcKuwFVujzS
218n9LdgEtkmGB9E2h3K4Vp7iGUaKuq23Zr32ehxiU8FWY7xoxbWTSA
221nHUhG1PgAG8H8myUENypM35JgfqXAKNQvRVVAFDRzJrny5eZN8d5
222nHBu9PTL9dn2GuZtdW4U2WzBwffyX9qsQCd9CNU4Z5YG3PQfViM8
223nHUPDdcdb2Y5DZAJne4c2iabFuAP3F34xZUgYQT2NH7qfkdapgnz
225[validator_list_sites]
226recommendedripplevalidators.com
227moreripplevalidators.net
23003E74EE14CB525AFBB9F1B7D86CD58ECC4B91452294B42AB4E78F260BD905C091D
231030775A669685BD6ABCEBD80385921C7851783D991A8055FD21D2F3966C96F1B56
233[validator_list_threshold]
248 path const& validatorsFileName,
249 bool useCounter =
true)
254 validatorsFileName.empty() ?
Config::validatorsFileName
255 : validatorsFileName),
270 return absolute(
file()).string();
282 using path = boost::filesystem::path;
304 BEAST_EXPECT(c.legacy("ssl_verify") ==
"0");
308 BEAST_EXPECT(c.
legacy(
"not_in_file") ==
"");
309 c.
legacy(
"not_in_file",
"new_value");
310 BEAST_EXPECT(c.
legacy(
"not_in_file") ==
"new_value");
317 using namespace boost::filesystem;
319 boost::format cc(
"[database_path]\n%1%\n");
321 auto const cwd = current_path();
322 path const dataDirRel(
"test_data_dir");
323 path const dataDirAbs(cwd / dataDirRel);
328 BEAST_EXPECT(c.
legacy(
"database_path") == dataDirAbs.string());
334 BEAST_EXPECT(c.
legacy(
"database_path") == dataDirAbs.string());
342 BEAST_EXPECT(c.
legacy(
"database_path") ==
"");
347 auto const cwd = current_path();
349 path const dataDirRel(
"test_data_dir");
350 path const dataDirAbs(cwd / g0.
subdir() / dataDirRel);
352 *
this, g0.
subdir(), dataDirAbs,
"",
false);
353 auto const& c(g.
config());
356 BEAST_EXPECT(c.legacy(
"database_path") == dataDirAbs.string());
362 auto const& c(g.
config());
366 BEAST_EXPECT(c.legacy(
"database_path") == nativeDbPath);
371 auto const& c(g.
config());
376 BEAST_EXPECT(c.legacy(
"database_path") == nativeDbPath);
388 "eyJ2YWxpZGF0aW9uX3ByaXZhdGVfa2V5IjoiOWVkNDVmODY2MjQxY2MxOGEyNzQ3Yj"
389 "U0Mzg3YzA2MjU5MDc5NzJmNGU3MTkwMjMxZmFhOTM3NDU3ZmE5ZGFmNiIsIm1hbmlm"
390 "ZXN0IjoiSkFBQUFBRnhJZTFGdHdtaW12R3RIMmlDY01KcUM5Z1ZGS2lsR2Z3MS92Q3"
391 "hIWFhMcGxjMkduTWhBa0UxYWdxWHhCd0R3RGJJRDZPTVNZdU0wRkRBbHBBZ05rOFNL"
392 "Rm43TU8yZmRrY3dSUUloQU9uZ3U5c0FLcVhZb3VKK2wyVjBXK3NBT2tWQitaUlM2UF"
393 "NobEpBZlVzWGZBaUJzVkpHZXNhYWRPSmMvYUFab2tTMXZ5bUdtVnJsSFBLV1gzWXl3"
394 "dTZpbjhIQVNRS1B1Z0JENjdrTWFSRkd2bXBBVEhsR0tKZHZERmxXUFl5NUFxRGVkRn"
395 "Y1VEphMncwaTIxZXEzTVl5d0xWSlpuRk9yN0Mwa3cyQWlUelNDakl6ZGl0UTg9In0"
400 static boost::format configTemplate(R
"rippleConfig(
408 auto const expectedError =
409 "Cannot have both [validation_seed] "
410 "and [validator_token] config sections";
420 BEAST_EXPECT(error == expectedError);
442 BEAST_EXPECT(error ==
"");
455 BEAST_EXPECT(error ==
"");
470 BEAST_EXPECT(error ==
"");
485 BEAST_EXPECT(error ==
"");
494 using namespace boost::filesystem;
497 boost::format cc(
"[validators_file]\n%1%\n");
499 std::string const missingPath =
"/no/way/this/path/exists";
500 auto const expectedError =
501 "The file specified in [validators_file] does not exist: " +
512 BEAST_EXPECT(error == expectedError);
517 *
this,
"test_cfg",
"validators.cfg");
518 path const invalidFile = current_path() / vtg.
subdir();
519 boost::format cc(
"[validators_file]\n%1%\n");
521 auto const expectedError =
522 "Invalid file specified in [validators_file]: " +
523 invalidFile.string();
533 BEAST_EXPECT(error == expectedError);
540n949f75evCHwgyP4fPVgaHqNHxUVN15PsJEZ3B3HnXPcPjcZAoy7
541n9MD5h24qrQqiyBC8aeqqCWvpiBiYQ3jxSr91uiDvmrkyHRdYLUj
542n9L81uNCaPgtUJfaHh89gmdvXKAmSt5Gdsw2g1iPWaPkAHW5Nm4C
545nHUhG1PgAG8H8myUENypM35JgfqXAKNQvRVVAFDRzJrny5eZN8d5
546nHBu9PTL9dn2GuZtdW4U2WzBwffyX9qsQCd9CNU4Z5YG3PQfViM8
549 BEAST_EXPECT(c.legacy("validators_file").empty());
557[validator_list_sites]
559trustthesevalidators.gov
562021A99A537FDEBC34E4FCA03B39BEADD04299BB19E85097EC92B15A3518801E566
564[validator_list_threshold]
572 "ripplevalidators.com");
575 "trustthesevalidators.gov");
580 "021A99A537FDEBC34E4FCA03B39BEADD04299BB19E85097EC92B15A3518801"
586 c.
section(SECTION_VALIDATOR_LIST_THRESHOLD).
values()[0] ==
"1");
593[validator_list_sites]
595trustthesevalidators.gov
598021A99A537FDEBC34E4FCA03B39BEADD04299BB19E85097EC92B15A3518801E566
600[validator_list_threshold]
608 "ripplevalidators.com");
611 "trustthesevalidators.gov");
616 "021A99A537FDEBC34E4FCA03B39BEADD04299BB19E85097EC92B15A3518801"
622 c.
section(SECTION_VALIDATOR_LIST_THRESHOLD).
values()[0] ==
"0");
630[validator_list_sites]
632trustthesevalidators.gov
635021A99A537FDEBC34E4FCA03B39BEADD04299BB19E85097EC92B15A3518801E566
637[validator_list_threshold]
641 auto const expectedError =
642 "Value in config section [validator_list_threshold] exceeds "
643 "the number of configured list keys";
653 BEAST_EXPECT(error == expectedError);
659[validator_list_sites]
661trustthesevalidators.gov
664021A99A537FDEBC34E4FCA03B39BEADD04299BB19E85097EC92B15A3518801E566
666[validator_list_threshold]
670 auto const expectedError =
671 "Config section [validator_list_threshold] should contain "
682 BEAST_EXPECT(error == expectedError);
688[validator_list_sites]
690trustthesevalidators.gov
693021A99A537FDEBC34E4FCA03B39BEADD04299BB19E85097EC92B15A3518801E566
695[validator_list_threshold]
715[validator_list_sites]
717trustthesevalidators.gov
720 auto const expectedError =
721 "[validator_list_keys] config section is missing";
731 BEAST_EXPECT(error == expectedError);
736 *
this,
"test_cfg",
"validators.cfg");
739 boost::format cc(
"[validators_file]\n%1%\n");
757 *
this,
"test_cfg", valFileName);
759 *
this, vtg.
subdir(),
"", valFileName,
false);
762 auto const& c(rcg.
config());
763 BEAST_EXPECT(c.legacy(
"validators_file") == valFileName);
764 BEAST_EXPECT(c.section(SECTION_VALIDATORS).values().size() == 8);
766 c.section(SECTION_VALIDATOR_LIST_SITES).values().size() == 2);
768 c.section(SECTION_VALIDATOR_LIST_KEYS).values().size() == 2);
770 c.section(SECTION_VALIDATOR_LIST_THRESHOLD).values().size() ==
772 BEAST_EXPECT(c.VALIDATOR_LIST_THRESHOLD == 2);
778 *
this,
"test_cfg",
"validators.txt");
779 auto const valFilePath =
".." / vtg.
subdir() /
"validators.txt";
781 *
this, vtg.
subdir(),
"", valFilePath,
false);
784 auto const& c(rcg.
config());
785 BEAST_EXPECT(c.legacy(
"validators_file") == valFilePath);
786 BEAST_EXPECT(c.section(SECTION_VALIDATORS).values().size() == 8);
788 c.section(SECTION_VALIDATOR_LIST_SITES).values().size() == 2);
790 c.section(SECTION_VALIDATOR_LIST_KEYS).values().size() == 2);
792 c.section(SECTION_VALIDATOR_LIST_THRESHOLD).values().size() ==
794 BEAST_EXPECT(c.VALIDATOR_LIST_THRESHOLD == 2);
799 *
this,
"test_cfg",
"validators.txt");
801 *
this, vtg.
subdir(),
"",
"",
false);
804 auto const& c(rcg.
config());
805 BEAST_EXPECT(c.legacy(
"validators_file").empty());
806 BEAST_EXPECT(c.section(SECTION_VALIDATORS).values().size() == 8);
808 c.section(SECTION_VALIDATOR_LIST_SITES).values().size() == 2);
810 c.section(SECTION_VALIDATOR_LIST_KEYS).values().size() == 2);
812 c.section(SECTION_VALIDATOR_LIST_THRESHOLD).values().size() ==
814 BEAST_EXPECT(c.VALIDATOR_LIST_THRESHOLD == 2);
820 *
this,
"test_cfg",
"validators.cfg");
823 *
this, vtg.
subdir(),
"validators.txt",
false);
828 auto const& c(rcg.
config());
829 BEAST_EXPECT(c.legacy(
"validators_file") == vtg.
validatorsFile());
830 BEAST_EXPECT(c.section(SECTION_VALIDATORS).values().size() == 8);
832 c.section(SECTION_VALIDATOR_LIST_SITES).values().size() == 2);
834 c.section(SECTION_VALIDATOR_LIST_KEYS).values().size() == 2);
836 c.section(SECTION_VALIDATOR_LIST_THRESHOLD).values().size() ==
838 BEAST_EXPECT(c.VALIDATOR_LIST_THRESHOLD == 2);
843 boost::format cc(R
"rippleConfig(
848n949f75evCHwgyP4fPVgaHqNHxUVN15PsJEZ3B3HnXPcPjcZAoy7
849n9MD5h24qrQqiyBC8aeqqCWvpiBiYQ3jxSr91uiDvmrkyHRdYLUj
850n9L81uNCaPgtUJfaHh89gmdvXKAmSt5Gdsw2g1iPWaPkAHW5Nm4C
851n9KiYM9CgngLvtRCQHZwgC2gjpdaZcCcbt3VboxiNFcKuwFVujzS
852n9LdgEtkmGB9E2h3K4Vp7iGUaKuq23Zr32ehxiU8FWY7xoxbWTSA
855nHB1X37qrniVugfQcuBTAjswphC1drx7QjFFojJPZwKHHnt8kU7v
856nHUkAWDR4cB8AgPg7VXMX6et8xRTQb2KJfgv1aBEXozwrawRKgMB
858[validator_list_sites]
860trustthesevalidators.gov
863021A99A537FDEBC34E4FCA03B39BEADD04299BB19E85097EC92B15A3518801E566
866 *
this,
"test_cfg",
"validators.cfg");
884 boost::format cc(R
"rippleConfig(
888[validator_list_threshold]
893 *
this,
"test_cfg",
"validators.cfg");
895 auto const expectedError =
896 "Config section [validator_list_threshold] should contain "
908 BEAST_EXPECT(error == expectedError);
915 boost::format cc(
"[validators_file]\n%1%\n");
918 *
this,
"test_cfg",
"validators.cfg");
920 auto const expectedError =
921 "The file specified in [validators_file] does not contain a "
922 "[validators], [validator_keys] or [validator_list_keys] "
935 BEAST_EXPECT(error == expectedError);
943 *
this,
"testSetup", explicitPath ?
"test_db" :
"",
"");
955 BEAST_EXPECT(!config.
quiet());
956 BEAST_EXPECT(!config.
silent());
959 BEAST_EXPECT(!config.
legacy(
"database_path").empty());
968 BEAST_EXPECT(config.
quiet());
969 BEAST_EXPECT(!config.
silent());
972 BEAST_EXPECT(!config.
legacy(
"database_path").empty());
981 BEAST_EXPECT(config.
quiet());
982 BEAST_EXPECT(config.
silent());
985 BEAST_EXPECT(!config.
legacy(
"database_path").empty());
994 BEAST_EXPECT(config.
quiet());
995 BEAST_EXPECT(config.
silent());
998 BEAST_EXPECT(!config.
legacy(
"database_path").empty());
1007 BEAST_EXPECT(!config.
quiet());
1008 BEAST_EXPECT(!config.
silent());
1012 config.
legacy(
"database_path").empty() == !explicitPath);
1021 BEAST_EXPECT(config.
quiet());
1022 BEAST_EXPECT(!config.
silent());
1026 config.
legacy(
"database_path").empty() == !explicitPath);
1035 BEAST_EXPECT(config.
quiet());
1036 BEAST_EXPECT(config.
silent());
1040 config.
legacy(
"database_path").empty() == !explicitPath);
1049 BEAST_EXPECT(config.
quiet());
1050 BEAST_EXPECT(config.
silent());
1054 config.
legacy(
"database_path").empty() == !explicitPath);
1062 auto const& conf = cfg.
config();
1063 if (!BEAST_EXPECT(conf.exists(
"port_rpc")))
1065 if (!BEAST_EXPECT(conf.exists(
"port_wss_admin")))
1088 *
this,
"testPort",
"",
"",
true, contents);
1089 BEAST_EXPECT(
false);
1094 "Invalid value '0' for key 'port'"));
1131 cfg.exists(SECTION_IPS) &&
1132 cfg.section(SECTION_IPS).lines().size() == 1 &&
1133 cfg.section(SECTION_IPS).values().size() == 1);
1135 cfg.exists(SECTION_IPS_FIXED) &&
1136 cfg.section(SECTION_IPS_FIXED).lines().size() == 2 &&
1137 cfg.section(SECTION_IPS_FIXED).values().size() == 2);
1166 anotherserversansport
1167 anotherserverwithport:12
1177 2001:db8:3333:4444:5555:6666:7777:8888:12345
1178 [2001:db8:3333:4444:5555:6666:7777:8888]:1
1187 cfg.
exists(SECTION_IPS) &&
1191 cfg.
exists(SECTION_IPS_FIXED) &&
1194 BEAST_EXPECT(cfg.
IPS[0] ==
"r.ripple.com 51235");
1196 BEAST_EXPECT(cfg.
IPS_FIXED[0] ==
"s1.ripple.com 51235");
1197 BEAST_EXPECT(cfg.
IPS_FIXED[1] ==
"s2.ripple.com 51235");
1198 BEAST_EXPECT(cfg.
IPS_FIXED[2] ==
"anotherserversansport");
1199 BEAST_EXPECT(cfg.
IPS_FIXED[3] ==
"anotherserverwithport 12");
1200 BEAST_EXPECT(cfg.
IPS_FIXED[4] ==
"1.1.1.1 1");
1201 BEAST_EXPECT(cfg.
IPS_FIXED[5] ==
"1.1.1.1 1");
1202 BEAST_EXPECT(cfg.
IPS_FIXED[6] ==
"12.34.12.123 12345");
1203 BEAST_EXPECT(cfg.
IPS_FIXED[7] ==
"12.34.12.123 12345");
1207 BEAST_EXPECT(cfg.
IPS_FIXED[9] ==
"2001:db8::");
1208 BEAST_EXPECT(cfg.
IPS_FIXED[10] ==
"::1");
1209 BEAST_EXPECT(cfg.
IPS_FIXED[11] ==
"::1:12345");
1210 BEAST_EXPECT(cfg.
IPS_FIXED[12] ==
"[::1]:12345");
1213 "2001:db8:3333:4444:5555:6666:7777:8888:12345");
1215 cfg.
IPS_FIXED[14] ==
"[2001:db8:3333:4444:5555:6666:7777:8888]:1");
1221 struct TestCommentData
1230 {{
"password = aaaa\\#bbbb",
"password",
"aaaa#bbbb",
false},
1231 {
"password = aaaa#bbbb",
"password",
"aaaa",
true},
1232 {
"password = aaaa #bbbb",
"password",
"aaaa",
true},
1234 {
"password = #aaaa #bbbb",
"",
"password =",
true},
1235 {
"password = aaaa\\# #bbbb",
"password",
"aaaa#",
true},
1236 {
"password = aaaa\\##bbbb",
"password",
"aaaa#",
true},
1237 {
"aaaa#bbbb",
"",
"aaaa",
true},
1238 {
"aaaa\\#bbbb",
"",
"aaaa#bbbb",
false},
1239 {
"aaaa\\##bbbb",
"",
"aaaa#",
true},
1240 {
"aaaa #bbbb",
"",
"aaaa",
true},
1241 {
"1 #comment",
"",
"1",
true},
1242 {
"#whole thing is comment",
"",
"",
false},
1243 {
" #whole comment with space",
"",
"",
false}}};
1245 for (
auto const& t : tests)
1248 s.append(t.line.data());
1249 BEAST_EXPECT(s.had_trailing_comments() == t.had_comment);
1250 if (t.field.empty())
1252 BEAST_EXPECTS(s.legacy() == t.expect, s.legacy());
1257 BEAST_EXPECTS(
set(field, t.field.data(), s), t.line);
1258 BEAST_EXPECTS(field == t.expect, t.line);
1264 s.append(
"online_delete = 3000");
1266 BEAST_EXPECT(
set(od,
"online_delete", s));
1267 BEAST_EXPECTS(od == 3000, *(s.get<
std::string>(
"online_delete")));
1272 s.append(
"online_delete = 2000 #my comment on this");
1274 BEAST_EXPECT(
set(od,
"online_delete", s));
1275 BEAST_EXPECTS(od == 2000, *(s.get<
std::string>(
"online_delete")));
1282 using namespace std::string_literals;
1283 Section s{
"MySection"};
1284 s.append(
"a_string = mystring");
1285 s.append(
"positive_int = 2");
1286 s.append(
"negative_int = -3");
1287 s.append(
"bool_ish = 1");
1290 auto val_1 =
"value 1"s;
1291 BEAST_EXPECT(
set(val_1,
"a_string", s));
1292 BEAST_EXPECT(val_1 ==
"mystring");
1294 auto val_2 =
"value 2"s;
1295 BEAST_EXPECT(!
set(val_2,
"not_a_key", s));
1296 BEAST_EXPECT(val_2 ==
"value 2");
1297 BEAST_EXPECT(!
set(val_2,
"default"s,
"not_a_key", s));
1298 BEAST_EXPECT(val_2 ==
"default");
1300 auto val_3 = get<std::string>(s,
"a_string");
1301 BEAST_EXPECT(val_3 ==
"mystring");
1302 auto val_4 = get<std::string>(s,
"not_a_key");
1303 BEAST_EXPECT(val_4 ==
"");
1304 auto val_5 = get<std::string>(s,
"not_a_key",
"default");
1305 BEAST_EXPECT(val_5 ==
"default");
1307 auto val_6 =
"value 6"s;
1309 BEAST_EXPECT(val_6 ==
"mystring");
1311 auto val_7 =
"value 7"s;
1313 BEAST_EXPECT(val_7 ==
"value 7");
1318 BEAST_EXPECT(
set(val_1,
"positive_int", s));
1319 BEAST_EXPECT(val_1 == 2);
1322 BEAST_EXPECT(
set(val_2,
"negative_int", s));
1323 BEAST_EXPECT(val_2 == -3);
1326 BEAST_EXPECT(!
set(val_3,
"a_string", s));
1327 BEAST_EXPECT(val_3 == 3);
1329 auto val_4 = get<int>(s,
"positive_int");
1330 BEAST_EXPECT(val_4 == 2);
1331 auto val_5 = get<int>(s,
"not_a_key");
1332 BEAST_EXPECT(val_5 == 0);
1333 auto val_6 = get<int>(s,
"not_a_key", 5);
1334 BEAST_EXPECT(val_6 == 5);
1335 auto val_7 = get<int>(s,
"a_string", 6);
1336 BEAST_EXPECT(val_7 == 6);
1340 BEAST_EXPECT(val_8 == 2);
1344 BEAST_EXPECT(val_9 == 9);
1348 BEAST_EXPECT(val_10 == 10);
1350 BEAST_EXPECT(s.get<
int>(
"not_a_key") == std::nullopt);
1353 s.get<
int>(
"a_string");
1356 catch (boost::bad_lexical_cast&)
1363 bool flag_1 =
false;
1365 BEAST_EXPECT(flag_1 ==
true);
1367 bool flag_2 =
false;
1369 BEAST_EXPECT(flag_2 ==
false);
1386 {
"seconds", 1, 15 * 60,
false},
1387 {
"minutes", 60, 14,
false},
1388 {
"minutes", 60, 15,
true},
1389 {
"hours", 3600, 10,
true},
1390 {
"days", 86400, 10,
true},
1391 {
"weeks", 604800, 2,
true},
1392 {
"months", 2592000, 1,
false},
1393 {
"years", 31536000, 1,
false}};
1396 for (
auto& [unit, sec, val, shouldPass] : units)
1400[amendment_majority_time]
1407 c.loadFromString(toLoad);
1410 c.AMENDMENT_MAJORITY_TIME.count() == val * sec);
1434 c.loadFromString(
"[overlay]\nmax_unknown_time=" + value);
1435 return c.MAX_UNKNOWN_TIME;
1444 BEAST_EXPECT(!testUnknown(
"none"));
1445 BEAST_EXPECT(!testUnknown(
"0.5"));
1446 BEAST_EXPECT(!testUnknown(
"180 seconds"));
1447 BEAST_EXPECT(!testUnknown(
"9 minutes"));
1450 BEAST_EXPECT(!testUnknown(
"299"));
1459 BEAST_EXPECT(!testUnknown(
"1801"));
1479 BEAST_EXPECT(!testDiverged(
"none"));
1480 BEAST_EXPECT(!testDiverged(
"0.5"));
1481 BEAST_EXPECT(!testDiverged(
"180 seconds"));
1482 BEAST_EXPECT(!testDiverged(
"9 minutes"));
1485 BEAST_EXPECT(!testDiverged(
"0"));
1486 BEAST_EXPECT(!testDiverged(
"59"));
1495 BEAST_EXPECT(!testDiverged(
"901"));
1519BEAST_DEFINE_TESTSUITE(Config, core,
ripple);
log_os< char > log
Logging output stream.
void pass()
Record a successful test condition.
testcase_t testcase
Memberspace for declaring test cases.
bool unexcept(F &&f, String const &reason)
void fail(String const &reason, char const *file, int line)
Record a failure.
bool exists(std::string const &name) const
Returns true if a section with the given name exists.
Section & section(std::string const &name)
Returns the section with the given name.
void legacy(std::string const §ion, std::string value)
Set a value that is not a key/value pair.
void testSetup(bool explicitPath)
void run() override
Runs the suite.
boost::filesystem::path path
void testValidatorsFile()
static char const *const databaseDirName
std::uint32_t LEDGER_HISTORY
std::vector< std::string > IPS_FIXED
void setup(std::string const &strConf, bool bQuiet, bool bSilent, bool bStandalone)
std::vector< std::string > IPS
std::optional< std::size_t > VALIDATOR_LIST_THRESHOLD
std::chrono::seconds MAX_DIVERGED_TIME
void loadFromString(std::string const &fileContents)
Load the config from the contents of the string.
std::vector< std::string > const & lines() const
Returns all the lines in the section.
std::vector< std::string > const & values() const
Returns all the values in the section.
bool expectException(Functor f, std::string const &message="")
Write a rippled config file and remove when done.
bool dataDirExists() const
RippledCfgGuard(beast::unit_test::suite &test, path subDir, path const &dbPath, path const &validatorsFile, bool useCounter=true, std::string confContents="")
bool configFileExists() const
Config const & config() const
std::string configFile() const
Write a validators.txt file and remove when done.
std::string validatorsFile() const
bool validatorsFileExists() const
ValidatorsTxtGuard(beast::unit_test::suite &test, path subDir, path const &validatorsFileName, bool useCounter=true)
Create a directory and remove it when it's done.
path const & subdir() const
auto rmDir(path const &toRm)
beast::unit_test::suite & test_
boost::filesystem::path path
Write a file in a directory and remove when done.
path const & file() const
FileDirGuard(beast::unit_test::suite &test, path subDir, path file, std::string const &contents, bool useCounter=true, bool create=true)
field_t< CharT, Traits, Allocator > field(std::basic_string< CharT, Traits, Allocator > const &text, int width=8, int pad=0, bool right=false)
std::string configContents(std::string const &dbPath, std::string const &validatorsFile)
std::string valFileContents()
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
static std::optional< Seed > validationSeed(Json::Value const ¶ms)
bool set(T &target, std::string const &name, Section const §ion)
Set a value from a configuration Section If the named value is not found or doesn't parse as a T,...
bool get_if_exists(Section const §ion, std::string const &name, T &v)
void parse_Port(ParsedPort &port, Section const §ion, std::ostream &log)
T regex_replace(T... args)
std::vector< boost::asio::ip::network_v4 > admin_nets_v4
std::vector< boost::asio::ip::network_v6 > admin_nets_v6