20#include <test/jtx/TestSuite.h>
21#include <test/unit_test/FileDirGuard.h>
22#include <xrpld/core/Config.h>
23#include <xrpld/core/ConfigSections.h>
24#include <xrpl/basics/contract.h>
25#include <xrpl/beast/unit_test/suite.h>
26#include <xrpl/server/Port.h>
27#include <boost/filesystem.hpp>
28#include <boost/format.hpp>
37 static boost::format configContentsTemplate(R
"rippleConfig(
65#-------------------------------------------------------------------------------
70# This is primary persistent datastore for rippled. This includes transaction
71# metadata, account states, and ledger headers. Helpful information can be
72# found on https://xrpl.org/capacity-planning.html#node-db-type
73# delete old ledgers while maintaining at least 2000. Do not require an
74# external administrative command to initiate deletion.
77path=/Users/dummy/ripple/config/db/rocksdb
88# This needs to be an absolute directory reference, not a relative one.
89# Modify this value as required.
91/Users/dummy/ripple/config/log/debug.log
99# Where to find some other servers speaking the Ripple protocol.
104# Turn down default logging to save disk space in the long run.
105# Valid values here are trace, debug, info, warning, error, and fatal
107{ "command": "log_level", "severity": "warning" }
109# Defaults to 1 ("yes") so that certificates will be validated. To allow the use
110# of self-signed certificates for development or internal use, set to 0 ("no").
119 dbPath.empty() ? "" :
"[database_path]\n" + dbPath;
121 validatorsFile.
empty() ?
"" :
"[validators_file]\n" + validatorsFile;
122 return boost::str(configContentsTemplate % dbPathSection % valFileSection);
142 path const& validatorsFile,
143 bool useCounter =
true)
172 return file().string();
178 return boost::filesystem::is_directory(
dataDir_);
191 using namespace boost::filesystem;
208n949f75evCHwgyP4fPVgaHqNHxUVN15PsJEZ3B3HnXPcPjcZAoy7
209n9MD5h24qrQqiyBC8aeqqCWvpiBiYQ3jxSr91uiDvmrkyHRdYLUj
210n9L81uNCaPgtUJfaHh89gmdvXKAmSt5Gdsw2g1iPWaPkAHW5Nm4C
211n9KiYM9CgngLvtRCQHZwgC2gjpdaZcCcbt3VboxiNFcKuwFVujzS
212n9LdgEtkmGB9E2h3K4Vp7iGUaKuq23Zr32ehxiU8FWY7xoxbWTSA
215nHUhG1PgAG8H8myUENypM35JgfqXAKNQvRVVAFDRzJrny5eZN8d5
216nHBu9PTL9dn2GuZtdW4U2WzBwffyX9qsQCd9CNU4Z5YG3PQfViM8
217nHUPDdcdb2Y5DZAJne4c2iabFuAP3F34xZUgYQT2NH7qfkdapgnz
219[validator_list_sites]
220recommendedripplevalidators.com
221moreripplevalidators.net
22403E74EE14CB525AFBB9F1B7D86CD58ECC4B91452294B42AB4E78F260BD905C091D
225030775A669685BD6ABCEBD80385921C7851783D991A8055FD21D2F3966C96F1B56
227[validator_list_threshold]
242 path const& validatorsFileName,
243 bool useCounter =
true)
248 validatorsFileName.empty() ?
Config::validatorsFileName
249 : validatorsFileName),
264 return absolute(
file()).string();
276 using path = boost::filesystem::path;
298 BEAST_EXPECT(c.legacy("ssl_verify") ==
"0");
302 BEAST_EXPECT(c.
legacy(
"not_in_file") ==
"");
303 c.
legacy(
"not_in_file",
"new_value");
304 BEAST_EXPECT(c.
legacy(
"not_in_file") ==
"new_value");
311 using namespace boost::filesystem;
313 boost::format cc(
"[database_path]\n%1%\n");
315 auto const cwd = current_path();
316 path const dataDirRel(
"test_data_dir");
317 path const dataDirAbs(cwd / dataDirRel);
322 BEAST_EXPECT(c.
legacy(
"database_path") == dataDirAbs.string());
328 BEAST_EXPECT(c.
legacy(
"database_path") == dataDirAbs.string());
336 BEAST_EXPECT(c.
legacy(
"database_path") ==
"");
341 auto const cwd = current_path();
343 path const dataDirRel(
"test_data_dir");
344 path const dataDirAbs(cwd / g0.
subdir() / dataDirRel);
346 *
this, g0.
subdir(), dataDirAbs,
"",
false);
347 auto const& c(g.
config());
350 BEAST_EXPECT(c.legacy(
"database_path") == dataDirAbs.string());
356 auto const& c(g.
config());
360 BEAST_EXPECT(c.legacy(
"database_path") == nativeDbPath);
365 auto const& c(g.
config());
370 BEAST_EXPECT(c.legacy(
"database_path") == nativeDbPath);
382 "eyJ2YWxpZGF0aW9uX3ByaXZhdGVfa2V5IjoiOWVkNDVmODY2MjQxY2MxOGEyNzQ3Yj"
383 "U0Mzg3YzA2MjU5MDc5NzJmNGU3MTkwMjMxZmFhOTM3NDU3ZmE5ZGFmNiIsIm1hbmlm"
384 "ZXN0IjoiSkFBQUFBRnhJZTFGdHdtaW12R3RIMmlDY01KcUM5Z1ZGS2lsR2Z3MS92Q3"
385 "hIWFhMcGxjMkduTWhBa0UxYWdxWHhCd0R3RGJJRDZPTVNZdU0wRkRBbHBBZ05rOFNL"
386 "Rm43TU8yZmRrY3dSUUloQU9uZ3U5c0FLcVhZb3VKK2wyVjBXK3NBT2tWQitaUlM2UF"
387 "NobEpBZlVzWGZBaUJzVkpHZXNhYWRPSmMvYUFab2tTMXZ5bUdtVnJsSFBLV1gzWXl3"
388 "dTZpbjhIQVNRS1B1Z0JENjdrTWFSRkd2bXBBVEhsR0tKZHZERmxXUFl5NUFxRGVkRn"
389 "Y1VEphMncwaTIxZXEzTVl5d0xWSlpuRk9yN0Mwa3cyQWlUelNDakl6ZGl0UTg9In0"
394 static boost::format configTemplate(R
"rippleConfig(
402 auto const expectedError =
403 "Cannot have both [validation_seed] "
404 "and [validator_token] config sections";
414 BEAST_EXPECT(error == expectedError);
436 BEAST_EXPECT(error ==
"");
449 BEAST_EXPECT(error ==
"");
464 BEAST_EXPECT(error ==
"");
479 BEAST_EXPECT(error ==
"");
488 using namespace boost::filesystem;
491 boost::format cc(
"[validators_file]\n%1%\n");
493 std::string const missingPath =
"/no/way/this/path/exists";
494 auto const expectedError =
495 "The file specified in [validators_file] does not exist: " +
506 BEAST_EXPECT(error == expectedError);
511 *
this,
"test_cfg",
"validators.cfg");
512 path const invalidFile = current_path() / vtg.
subdir();
513 boost::format cc(
"[validators_file]\n%1%\n");
515 auto const expectedError =
516 "Invalid file specified in [validators_file]: " +
517 invalidFile.string();
527 BEAST_EXPECT(error == expectedError);
534n949f75evCHwgyP4fPVgaHqNHxUVN15PsJEZ3B3HnXPcPjcZAoy7
535n9MD5h24qrQqiyBC8aeqqCWvpiBiYQ3jxSr91uiDvmrkyHRdYLUj
536n9L81uNCaPgtUJfaHh89gmdvXKAmSt5Gdsw2g1iPWaPkAHW5Nm4C
539nHUhG1PgAG8H8myUENypM35JgfqXAKNQvRVVAFDRzJrny5eZN8d5
540nHBu9PTL9dn2GuZtdW4U2WzBwffyX9qsQCd9CNU4Z5YG3PQfViM8
543 BEAST_EXPECT(c.legacy("validators_file").empty());
551[validator_list_sites]
553trustthesevalidators.gov
556021A99A537FDEBC34E4FCA03B39BEADD04299BB19E85097EC92B15A3518801E566
558[validator_list_threshold]
566 "ripplevalidators.com");
569 "trustthesevalidators.gov");
574 "021A99A537FDEBC34E4FCA03B39BEADD04299BB19E85097EC92B15A3518801"
580 c.
section(SECTION_VALIDATOR_LIST_THRESHOLD).
values()[0] ==
"1");
587[validator_list_sites]
589trustthesevalidators.gov
592021A99A537FDEBC34E4FCA03B39BEADD04299BB19E85097EC92B15A3518801E566
594[validator_list_threshold]
602 "ripplevalidators.com");
605 "trustthesevalidators.gov");
610 "021A99A537FDEBC34E4FCA03B39BEADD04299BB19E85097EC92B15A3518801"
616 c.
section(SECTION_VALIDATOR_LIST_THRESHOLD).
values()[0] ==
"0");
624[validator_list_sites]
626trustthesevalidators.gov
629021A99A537FDEBC34E4FCA03B39BEADD04299BB19E85097EC92B15A3518801E566
631[validator_list_threshold]
635 auto const expectedError =
636 "Value in config section [validator_list_threshold] exceeds "
637 "the number of configured list keys";
647 BEAST_EXPECT(error == expectedError);
653[validator_list_sites]
655trustthesevalidators.gov
658021A99A537FDEBC34E4FCA03B39BEADD04299BB19E85097EC92B15A3518801E566
660[validator_list_threshold]
664 auto const expectedError =
665 "Config section [validator_list_threshold] should contain "
676 BEAST_EXPECT(error == expectedError);
682[validator_list_sites]
684trustthesevalidators.gov
687021A99A537FDEBC34E4FCA03B39BEADD04299BB19E85097EC92B15A3518801E566
689[validator_list_threshold]
709[validator_list_sites]
711trustthesevalidators.gov
714 auto const expectedError =
715 "[validator_list_keys] config section is missing";
725 BEAST_EXPECT(error == expectedError);
730 *
this,
"test_cfg",
"validators.cfg");
733 boost::format cc(
"[validators_file]\n%1%\n");
751 *
this,
"test_cfg", valFileName);
753 *
this, vtg.
subdir(),
"", valFileName,
false);
756 auto const& c(rcg.
config());
757 BEAST_EXPECT(c.legacy(
"validators_file") == valFileName);
758 BEAST_EXPECT(c.section(SECTION_VALIDATORS).values().size() == 8);
760 c.section(SECTION_VALIDATOR_LIST_SITES).values().size() == 2);
762 c.section(SECTION_VALIDATOR_LIST_KEYS).values().size() == 2);
764 c.section(SECTION_VALIDATOR_LIST_THRESHOLD).values().size() ==
766 BEAST_EXPECT(c.VALIDATOR_LIST_THRESHOLD == 2);
772 *
this,
"test_cfg",
"validators.txt");
773 auto const valFilePath =
".." / vtg.
subdir() /
"validators.txt";
775 *
this, vtg.
subdir(),
"", valFilePath,
false);
778 auto const& c(rcg.
config());
779 BEAST_EXPECT(c.legacy(
"validators_file") == valFilePath);
780 BEAST_EXPECT(c.section(SECTION_VALIDATORS).values().size() == 8);
782 c.section(SECTION_VALIDATOR_LIST_SITES).values().size() == 2);
784 c.section(SECTION_VALIDATOR_LIST_KEYS).values().size() == 2);
786 c.section(SECTION_VALIDATOR_LIST_THRESHOLD).values().size() ==
788 BEAST_EXPECT(c.VALIDATOR_LIST_THRESHOLD == 2);
793 *
this,
"test_cfg",
"validators.txt");
795 *
this, vtg.
subdir(),
"",
"",
false);
798 auto const& c(rcg.
config());
799 BEAST_EXPECT(c.legacy(
"validators_file").empty());
800 BEAST_EXPECT(c.section(SECTION_VALIDATORS).values().size() == 8);
802 c.section(SECTION_VALIDATOR_LIST_SITES).values().size() == 2);
804 c.section(SECTION_VALIDATOR_LIST_KEYS).values().size() == 2);
806 c.section(SECTION_VALIDATOR_LIST_THRESHOLD).values().size() ==
808 BEAST_EXPECT(c.VALIDATOR_LIST_THRESHOLD == 2);
814 *
this,
"test_cfg",
"validators.cfg");
817 *
this, vtg.
subdir(),
"validators.txt",
false);
822 auto const& c(rcg.
config());
823 BEAST_EXPECT(c.legacy(
"validators_file") == vtg.
validatorsFile());
824 BEAST_EXPECT(c.section(SECTION_VALIDATORS).values().size() == 8);
826 c.section(SECTION_VALIDATOR_LIST_SITES).values().size() == 2);
828 c.section(SECTION_VALIDATOR_LIST_KEYS).values().size() == 2);
830 c.section(SECTION_VALIDATOR_LIST_THRESHOLD).values().size() ==
832 BEAST_EXPECT(c.VALIDATOR_LIST_THRESHOLD == 2);
837 boost::format cc(R
"rippleConfig(
842n949f75evCHwgyP4fPVgaHqNHxUVN15PsJEZ3B3HnXPcPjcZAoy7
843n9MD5h24qrQqiyBC8aeqqCWvpiBiYQ3jxSr91uiDvmrkyHRdYLUj
844n9L81uNCaPgtUJfaHh89gmdvXKAmSt5Gdsw2g1iPWaPkAHW5Nm4C
845n9KiYM9CgngLvtRCQHZwgC2gjpdaZcCcbt3VboxiNFcKuwFVujzS
846n9LdgEtkmGB9E2h3K4Vp7iGUaKuq23Zr32ehxiU8FWY7xoxbWTSA
849nHB1X37qrniVugfQcuBTAjswphC1drx7QjFFojJPZwKHHnt8kU7v
850nHUkAWDR4cB8AgPg7VXMX6et8xRTQb2KJfgv1aBEXozwrawRKgMB
852[validator_list_sites]
854trustthesevalidators.gov
857021A99A537FDEBC34E4FCA03B39BEADD04299BB19E85097EC92B15A3518801E566
860 *
this,
"test_cfg",
"validators.cfg");
878 boost::format cc(R
"rippleConfig(
882[validator_list_threshold]
887 *
this,
"test_cfg",
"validators.cfg");
889 auto const expectedError =
890 "Config section [validator_list_threshold] should contain "
902 BEAST_EXPECT(error == expectedError);
909 boost::format cc(
"[validators_file]\n%1%\n");
912 *
this,
"test_cfg",
"validators.cfg");
914 auto const expectedError =
915 "The file specified in [validators_file] does not contain a "
916 "[validators], [validator_keys] or [validator_list_keys] "
929 BEAST_EXPECT(error == expectedError);
937 *
this,
"testSetup", explicitPath ?
"test_db" :
"",
"");
949 BEAST_EXPECT(!config.
quiet());
950 BEAST_EXPECT(!config.
silent());
953 BEAST_EXPECT(!config.
legacy(
"database_path").empty());
962 BEAST_EXPECT(config.
quiet());
963 BEAST_EXPECT(!config.
silent());
966 BEAST_EXPECT(!config.
legacy(
"database_path").empty());
975 BEAST_EXPECT(config.
quiet());
976 BEAST_EXPECT(config.
silent());
979 BEAST_EXPECT(!config.
legacy(
"database_path").empty());
988 BEAST_EXPECT(config.
quiet());
989 BEAST_EXPECT(config.
silent());
992 BEAST_EXPECT(!config.
legacy(
"database_path").empty());
1001 BEAST_EXPECT(!config.
quiet());
1002 BEAST_EXPECT(!config.
silent());
1006 config.
legacy(
"database_path").empty() == !explicitPath);
1015 BEAST_EXPECT(config.
quiet());
1016 BEAST_EXPECT(!config.
silent());
1020 config.
legacy(
"database_path").empty() == !explicitPath);
1029 BEAST_EXPECT(config.
quiet());
1030 BEAST_EXPECT(config.
silent());
1034 config.
legacy(
"database_path").empty() == !explicitPath);
1043 BEAST_EXPECT(config.
quiet());
1044 BEAST_EXPECT(config.
silent());
1048 config.
legacy(
"database_path").empty() == !explicitPath);
1056 auto const& conf = cfg.
config();
1057 if (!BEAST_EXPECT(conf.exists(
"port_rpc")))
1059 if (!BEAST_EXPECT(conf.exists(
"port_wss_admin")))
1104 cfg.exists(SECTION_IPS) &&
1105 cfg.section(SECTION_IPS).lines().size() == 1 &&
1106 cfg.section(SECTION_IPS).values().size() == 1);
1108 cfg.exists(SECTION_IPS_FIXED) &&
1109 cfg.section(SECTION_IPS_FIXED).lines().size() == 2 &&
1110 cfg.section(SECTION_IPS_FIXED).values().size() == 2);
1139 anotherserversansport
1140 anotherserverwithport:12
1150 2001:db8:3333:4444:5555:6666:7777:8888:12345
1151 [2001:db8:3333:4444:5555:6666:7777:8888]:1
1160 cfg.
exists(SECTION_IPS) &&
1164 cfg.
exists(SECTION_IPS_FIXED) &&
1167 BEAST_EXPECT(cfg.
IPS[0] ==
"r.ripple.com 51235");
1169 BEAST_EXPECT(cfg.
IPS_FIXED[0] ==
"s1.ripple.com 51235");
1170 BEAST_EXPECT(cfg.
IPS_FIXED[1] ==
"s2.ripple.com 51235");
1171 BEAST_EXPECT(cfg.
IPS_FIXED[2] ==
"anotherserversansport");
1172 BEAST_EXPECT(cfg.
IPS_FIXED[3] ==
"anotherserverwithport 12");
1173 BEAST_EXPECT(cfg.
IPS_FIXED[4] ==
"1.1.1.1 1");
1174 BEAST_EXPECT(cfg.
IPS_FIXED[5] ==
"1.1.1.1 1");
1175 BEAST_EXPECT(cfg.
IPS_FIXED[6] ==
"12.34.12.123 12345");
1176 BEAST_EXPECT(cfg.
IPS_FIXED[7] ==
"12.34.12.123 12345");
1180 BEAST_EXPECT(cfg.
IPS_FIXED[9] ==
"2001:db8::");
1181 BEAST_EXPECT(cfg.
IPS_FIXED[10] ==
"::1");
1182 BEAST_EXPECT(cfg.
IPS_FIXED[11] ==
"::1:12345");
1183 BEAST_EXPECT(cfg.
IPS_FIXED[12] ==
"[::1]:12345");
1186 "2001:db8:3333:4444:5555:6666:7777:8888:12345");
1188 cfg.
IPS_FIXED[14] ==
"[2001:db8:3333:4444:5555:6666:7777:8888]:1");
1194 struct TestCommentData
1203 {{
"password = aaaa\\#bbbb",
"password",
"aaaa#bbbb",
false},
1204 {
"password = aaaa#bbbb",
"password",
"aaaa",
true},
1205 {
"password = aaaa #bbbb",
"password",
"aaaa",
true},
1207 {
"password = #aaaa #bbbb",
"",
"password =",
true},
1208 {
"password = aaaa\\# #bbbb",
"password",
"aaaa#",
true},
1209 {
"password = aaaa\\##bbbb",
"password",
"aaaa#",
true},
1210 {
"aaaa#bbbb",
"",
"aaaa",
true},
1211 {
"aaaa\\#bbbb",
"",
"aaaa#bbbb",
false},
1212 {
"aaaa\\##bbbb",
"",
"aaaa#",
true},
1213 {
"aaaa #bbbb",
"",
"aaaa",
true},
1214 {
"1 #comment",
"",
"1",
true},
1215 {
"#whole thing is comment",
"",
"",
false},
1216 {
" #whole comment with space",
"",
"",
false}}};
1218 for (
auto const& t : tests)
1221 s.append(t.line.data());
1222 BEAST_EXPECT(s.had_trailing_comments() == t.had_comment);
1223 if (t.field.empty())
1225 BEAST_EXPECTS(s.legacy() == t.expect, s.legacy());
1230 BEAST_EXPECTS(
set(field, t.field.data(), s), t.line);
1231 BEAST_EXPECTS(field == t.expect, t.line);
1237 s.append(
"online_delete = 3000");
1239 BEAST_EXPECT(
set(od,
"online_delete", s));
1240 BEAST_EXPECTS(od == 3000, *(s.get<
std::string>(
"online_delete")));
1245 s.append(
"online_delete = 2000 #my comment on this");
1247 BEAST_EXPECT(
set(od,
"online_delete", s));
1248 BEAST_EXPECTS(od == 2000, *(s.get<
std::string>(
"online_delete")));
1255 using namespace std::string_literals;
1256 Section s{
"MySection"};
1257 s.append(
"a_string = mystring");
1258 s.append(
"positive_int = 2");
1259 s.append(
"negative_int = -3");
1260 s.append(
"bool_ish = 1");
1263 auto val_1 =
"value 1"s;
1264 BEAST_EXPECT(
set(val_1,
"a_string", s));
1265 BEAST_EXPECT(val_1 ==
"mystring");
1267 auto val_2 =
"value 2"s;
1268 BEAST_EXPECT(!
set(val_2,
"not_a_key", s));
1269 BEAST_EXPECT(val_2 ==
"value 2");
1270 BEAST_EXPECT(!
set(val_2,
"default"s,
"not_a_key", s));
1271 BEAST_EXPECT(val_2 ==
"default");
1273 auto val_3 = get<std::string>(s,
"a_string");
1274 BEAST_EXPECT(val_3 ==
"mystring");
1275 auto val_4 = get<std::string>(s,
"not_a_key");
1276 BEAST_EXPECT(val_4 ==
"");
1277 auto val_5 = get<std::string>(s,
"not_a_key",
"default");
1278 BEAST_EXPECT(val_5 ==
"default");
1280 auto val_6 =
"value 6"s;
1282 BEAST_EXPECT(val_6 ==
"mystring");
1284 auto val_7 =
"value 7"s;
1286 BEAST_EXPECT(val_7 ==
"value 7");
1291 BEAST_EXPECT(
set(val_1,
"positive_int", s));
1292 BEAST_EXPECT(val_1 == 2);
1295 BEAST_EXPECT(
set(val_2,
"negative_int", s));
1296 BEAST_EXPECT(val_2 == -3);
1299 BEAST_EXPECT(!
set(val_3,
"a_string", s));
1300 BEAST_EXPECT(val_3 == 3);
1302 auto val_4 = get<int>(s,
"positive_int");
1303 BEAST_EXPECT(val_4 == 2);
1304 auto val_5 = get<int>(s,
"not_a_key");
1305 BEAST_EXPECT(val_5 == 0);
1306 auto val_6 = get<int>(s,
"not_a_key", 5);
1307 BEAST_EXPECT(val_6 == 5);
1308 auto val_7 = get<int>(s,
"a_string", 6);
1309 BEAST_EXPECT(val_7 == 6);
1313 BEAST_EXPECT(val_8 == 2);
1317 BEAST_EXPECT(val_9 == 9);
1321 BEAST_EXPECT(val_10 == 10);
1323 BEAST_EXPECT(s.get<
int>(
"not_a_key") == std::nullopt);
1326 s.get<
int>(
"a_string");
1329 catch (boost::bad_lexical_cast&)
1336 bool flag_1 =
false;
1338 BEAST_EXPECT(flag_1 ==
true);
1340 bool flag_2 =
false;
1342 BEAST_EXPECT(flag_2 ==
false);
1359 {
"seconds", 1, 15 * 60,
false},
1360 {
"minutes", 60, 14,
false},
1361 {
"minutes", 60, 15,
true},
1362 {
"hours", 3600, 10,
true},
1363 {
"days", 86400, 10,
true},
1364 {
"weeks", 604800, 2,
true},
1365 {
"months", 2592000, 1,
false},
1366 {
"years", 31536000, 1,
false}};
1369 for (
auto& [unit, sec, val, shouldPass] : units)
1373[amendment_majority_time]
1380 c.loadFromString(toLoad);
1383 c.AMENDMENT_MAJORITY_TIME.count() == val * sec);
1407 c.loadFromString(
"[overlay]\nmax_unknown_time=" + value);
1408 return c.MAX_UNKNOWN_TIME;
1417 BEAST_EXPECT(!testUnknown(
"none"));
1418 BEAST_EXPECT(!testUnknown(
"0.5"));
1419 BEAST_EXPECT(!testUnknown(
"180 seconds"));
1420 BEAST_EXPECT(!testUnknown(
"9 minutes"));
1423 BEAST_EXPECT(!testUnknown(
"299"));
1432 BEAST_EXPECT(!testUnknown(
"1801"));
1452 BEAST_EXPECT(!testDiverged(
"none"));
1453 BEAST_EXPECT(!testDiverged(
"0.5"));
1454 BEAST_EXPECT(!testDiverged(
"180 seconds"));
1455 BEAST_EXPECT(!testDiverged(
"9 minutes"));
1458 BEAST_EXPECT(!testDiverged(
"0"));
1459 BEAST_EXPECT(!testDiverged(
"59"));
1468 BEAST_EXPECT(!testDiverged(
"901"));
1491BEAST_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
bool configFileExists() const
Config const & config() const
RippledCfgGuard(beast::unit_test::suite &test, path subDir, path const &dbPath, path const &validatorsFile, bool useCounter=true)
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)
std::vector< boost::asio::ip::network_v4 > admin_nets_v4
std::vector< boost::asio::ip::network_v6 > admin_nets_v6