1#include <test/jtx/TestSuite.h>
2#include <test/unit_test/FileDirGuard.h>
4#include <xrpld/core/Config.h>
5#include <xrpld/core/ConfigSections.h>
7#include <xrpl/beast/unit_test/suite.h>
8#include <xrpl/server/Port.h>
10#include <boost/filesystem.hpp>
11#include <boost/format.hpp>
21 static boost::format configContentsTemplate(R
"rippleConfig(
49#-------------------------------------------------------------------------------
54# This is primary persistent datastore for rippled. This includes transaction
55# metadata, account states, and ledger headers. Helpful information can be
56# found on https://xrpl.org/capacity-planning.html#node-db-type
57# delete old ledgers while maintaining at least 2000. Do not require an
58# external administrative command to initiate deletion.
61path=/Users/dummy/ripple/config/db/rocksdb
72# This needs to be an absolute directory reference, not a relative one.
73# Modify this value as required.
75/Users/dummy/ripple/config/log/debug.log
83# Where to find some other servers speaking the Ripple protocol.
88# Turn down default logging to save disk space in the long run.
89# Valid values here are trace, debug, info, warning, error, and fatal
91{ "command": "log_level", "severity": "warning" }
93# Defaults to 1 ("yes") so that certificates will be validated. To allow the use
94# of self-signed certificates for development or internal use, set to 0 ("no").
103 dbPath.empty() ? "" :
"[database_path]\n" + dbPath;
105 validatorsFile.
empty() ?
"" :
"[validators_file]\n" + validatorsFile;
106 return boost::str(configContentsTemplate % dbPathSection % valFileSection);
126 path const& validatorsFile,
127 bool useCounter =
true,
165 return boost::filesystem::is_directory(
dataDir_);
178 using namespace boost::filesystem;
195n949f75evCHwgyP4fPVgaHqNHxUVN15PsJEZ3B3HnXPcPjcZAoy7
196n9MD5h24qrQqiyBC8aeqqCWvpiBiYQ3jxSr91uiDvmrkyHRdYLUj
197n9L81uNCaPgtUJfaHh89gmdvXKAmSt5Gdsw2g1iPWaPkAHW5Nm4C
198n9KiYM9CgngLvtRCQHZwgC2gjpdaZcCcbt3VboxiNFcKuwFVujzS
199n9LdgEtkmGB9E2h3K4Vp7iGUaKuq23Zr32ehxiU8FWY7xoxbWTSA
202nHUhG1PgAG8H8myUENypM35JgfqXAKNQvRVVAFDRzJrny5eZN8d5
203nHBu9PTL9dn2GuZtdW4U2WzBwffyX9qsQCd9CNU4Z5YG3PQfViM8
204nHUPDdcdb2Y5DZAJne4c2iabFuAP3F34xZUgYQT2NH7qfkdapgnz
206[validator_list_sites]
207recommendedripplevalidators.com
208moreripplevalidators.net
21103E74EE14CB525AFBB9F1B7D86CD58ECC4B91452294B42AB4E78F260BD905C091D
212030775A669685BD6ABCEBD80385921C7851783D991A8055FD21D2F3966C96F1B56
214[validator_list_threshold]
229 path const& validatorsFileName,
230 bool useCounter =
true)
235 validatorsFileName.empty() ?
Config::validatorsFileName
236 : validatorsFileName),
251 return absolute(
file()).string();
263 using path = boost::filesystem::path;
285 BEAST_EXPECT(c.legacy("ssl_verify") ==
"0");
289 BEAST_EXPECT(c.
legacy(
"not_in_file") ==
"");
290 c.
legacy(
"not_in_file",
"new_value");
291 BEAST_EXPECT(c.
legacy(
"not_in_file") ==
"new_value");
298 using namespace boost::filesystem;
300 boost::format cc(
"[database_path]\n%1%\n");
302 auto const cwd = current_path();
303 path const dataDirRel(
"test_data_dir");
304 path const dataDirAbs(cwd / dataDirRel);
309 BEAST_EXPECT(c.
legacy(
"database_path") == dataDirAbs.string());
315 BEAST_EXPECT(c.
legacy(
"database_path") == dataDirAbs.string());
323 BEAST_EXPECT(c.
legacy(
"database_path") ==
"");
328 auto const cwd = current_path();
330 path const dataDirRel(
"test_data_dir");
331 path const dataDirAbs(cwd / g0.
subdir() / dataDirRel);
333 *
this, g0.
subdir(), dataDirAbs,
"",
false);
334 auto const& c(g.
config());
337 BEAST_EXPECT(c.legacy(
"database_path") == dataDirAbs.string());
343 auto const& c(g.
config());
347 BEAST_EXPECT(c.legacy(
"database_path") == nativeDbPath);
352 auto const& c(g.
config());
357 BEAST_EXPECT(c.legacy(
"database_path") == nativeDbPath);
369 "eyJ2YWxpZGF0aW9uX3ByaXZhdGVfa2V5IjoiOWVkNDVmODY2MjQxY2MxOGEyNzQ3Yj"
370 "U0Mzg3YzA2MjU5MDc5NzJmNGU3MTkwMjMxZmFhOTM3NDU3ZmE5ZGFmNiIsIm1hbmlm"
371 "ZXN0IjoiSkFBQUFBRnhJZTFGdHdtaW12R3RIMmlDY01KcUM5Z1ZGS2lsR2Z3MS92Q3"
372 "hIWFhMcGxjMkduTWhBa0UxYWdxWHhCd0R3RGJJRDZPTVNZdU0wRkRBbHBBZ05rOFNL"
373 "Rm43TU8yZmRrY3dSUUloQU9uZ3U5c0FLcVhZb3VKK2wyVjBXK3NBT2tWQitaUlM2UF"
374 "NobEpBZlVzWGZBaUJzVkpHZXNhYWRPSmMvYUFab2tTMXZ5bUdtVnJsSFBLV1gzWXl3"
375 "dTZpbjhIQVNRS1B1Z0JENjdrTWFSRkd2bXBBVEhsR0tKZHZERmxXUFl5NUFxRGVkRn"
376 "Y1VEphMncwaTIxZXEzTVl5d0xWSlpuRk9yN0Mwa3cyQWlUelNDakl6ZGl0UTg9In0"
381 static boost::format configTemplate(R
"rippleConfig(
389 auto const expectedError =
390 "Cannot have both [validation_seed] "
391 "and [validator_token] config sections";
401 BEAST_EXPECT(error == expectedError);
423 BEAST_EXPECT(error ==
"");
436 BEAST_EXPECT(error ==
"");
451 BEAST_EXPECT(error ==
"");
466 BEAST_EXPECT(error ==
"");
475 using namespace boost::filesystem;
478 boost::format cc(
"[validators_file]\n%1%\n");
480 std::string const missingPath =
"/no/way/this/path/exists";
481 auto const expectedError =
482 "The file specified in [validators_file] does not exist: " +
493 BEAST_EXPECT(error == expectedError);
498 *
this,
"test_cfg",
"validators.cfg");
499 path const invalidFile = current_path() / vtg.
subdir();
500 boost::format cc(
"[validators_file]\n%1%\n");
502 auto const expectedError =
503 "Invalid file specified in [validators_file]: " +
504 invalidFile.string();
514 BEAST_EXPECT(error == expectedError);
521n949f75evCHwgyP4fPVgaHqNHxUVN15PsJEZ3B3HnXPcPjcZAoy7
522n9MD5h24qrQqiyBC8aeqqCWvpiBiYQ3jxSr91uiDvmrkyHRdYLUj
523n9L81uNCaPgtUJfaHh89gmdvXKAmSt5Gdsw2g1iPWaPkAHW5Nm4C
526nHUhG1PgAG8H8myUENypM35JgfqXAKNQvRVVAFDRzJrny5eZN8d5
527nHBu9PTL9dn2GuZtdW4U2WzBwffyX9qsQCd9CNU4Z5YG3PQfViM8
530 BEAST_EXPECT(c.legacy("validators_file").empty());
538[validator_list_sites]
540trustthesevalidators.gov
543021A99A537FDEBC34E4FCA03B39BEADD04299BB19E85097EC92B15A3518801E566
545[validator_list_threshold]
553 "ripplevalidators.com");
556 "trustthesevalidators.gov");
561 "021A99A537FDEBC34E4FCA03B39BEADD04299BB19E85097EC92B15A3518801"
567 c.
section(SECTION_VALIDATOR_LIST_THRESHOLD).
values()[0] ==
"1");
574[validator_list_sites]
576trustthesevalidators.gov
579021A99A537FDEBC34E4FCA03B39BEADD04299BB19E85097EC92B15A3518801E566
581[validator_list_threshold]
589 "ripplevalidators.com");
592 "trustthesevalidators.gov");
597 "021A99A537FDEBC34E4FCA03B39BEADD04299BB19E85097EC92B15A3518801"
603 c.
section(SECTION_VALIDATOR_LIST_THRESHOLD).
values()[0] ==
"0");
611[validator_list_sites]
613trustthesevalidators.gov
616021A99A537FDEBC34E4FCA03B39BEADD04299BB19E85097EC92B15A3518801E566
618[validator_list_threshold]
622 auto const expectedError =
623 "Value in config section [validator_list_threshold] exceeds "
624 "the number of configured list keys";
634 BEAST_EXPECT(error == expectedError);
640[validator_list_sites]
642trustthesevalidators.gov
645021A99A537FDEBC34E4FCA03B39BEADD04299BB19E85097EC92B15A3518801E566
647[validator_list_threshold]
651 auto const expectedError =
652 "Config section [validator_list_threshold] should contain "
663 BEAST_EXPECT(error == expectedError);
669[validator_list_sites]
671trustthesevalidators.gov
674021A99A537FDEBC34E4FCA03B39BEADD04299BB19E85097EC92B15A3518801E566
676[validator_list_threshold]
696[validator_list_sites]
698trustthesevalidators.gov
701 auto const expectedError =
702 "[validator_list_keys] config section is missing";
712 BEAST_EXPECT(error == expectedError);
717 *
this,
"test_cfg",
"validators.cfg");
720 boost::format cc(
"[validators_file]\n%1%\n");
738 *
this,
"test_cfg", valFileName);
740 *
this, vtg.
subdir(),
"", valFileName,
false);
743 auto const& c(rcg.
config());
744 BEAST_EXPECT(c.legacy(
"validators_file") == valFileName);
745 BEAST_EXPECT(c.section(SECTION_VALIDATORS).values().size() == 8);
747 c.section(SECTION_VALIDATOR_LIST_SITES).values().size() == 2);
749 c.section(SECTION_VALIDATOR_LIST_KEYS).values().size() == 2);
751 c.section(SECTION_VALIDATOR_LIST_THRESHOLD).values().size() ==
753 BEAST_EXPECT(c.VALIDATOR_LIST_THRESHOLD == 2);
759 *
this,
"test_cfg",
"validators.txt");
760 auto const valFilePath =
".." / vtg.
subdir() /
"validators.txt";
762 *
this, vtg.
subdir(),
"", valFilePath,
false);
765 auto const& c(rcg.
config());
766 BEAST_EXPECT(c.legacy(
"validators_file") == valFilePath);
767 BEAST_EXPECT(c.section(SECTION_VALIDATORS).values().size() == 8);
769 c.section(SECTION_VALIDATOR_LIST_SITES).values().size() == 2);
771 c.section(SECTION_VALIDATOR_LIST_KEYS).values().size() == 2);
773 c.section(SECTION_VALIDATOR_LIST_THRESHOLD).values().size() ==
775 BEAST_EXPECT(c.VALIDATOR_LIST_THRESHOLD == 2);
780 *
this,
"test_cfg",
"validators.txt");
782 *
this, vtg.
subdir(),
"",
"",
false);
785 auto const& c(rcg.
config());
786 BEAST_EXPECT(c.legacy(
"validators_file").empty());
787 BEAST_EXPECT(c.section(SECTION_VALIDATORS).values().size() == 8);
789 c.section(SECTION_VALIDATOR_LIST_SITES).values().size() == 2);
791 c.section(SECTION_VALIDATOR_LIST_KEYS).values().size() == 2);
793 c.section(SECTION_VALIDATOR_LIST_THRESHOLD).values().size() ==
795 BEAST_EXPECT(c.VALIDATOR_LIST_THRESHOLD == 2);
801 *
this,
"test_cfg",
"validators.cfg");
804 *
this, vtg.
subdir(),
"validators.txt",
false);
809 auto const& c(rcg.
config());
810 BEAST_EXPECT(c.legacy(
"validators_file") == vtg.
validatorsFile());
811 BEAST_EXPECT(c.section(SECTION_VALIDATORS).values().size() == 8);
813 c.section(SECTION_VALIDATOR_LIST_SITES).values().size() == 2);
815 c.section(SECTION_VALIDATOR_LIST_KEYS).values().size() == 2);
817 c.section(SECTION_VALIDATOR_LIST_THRESHOLD).values().size() ==
819 BEAST_EXPECT(c.VALIDATOR_LIST_THRESHOLD == 2);
824 boost::format cc(R
"rippleConfig(
829n949f75evCHwgyP4fPVgaHqNHxUVN15PsJEZ3B3HnXPcPjcZAoy7
830n9MD5h24qrQqiyBC8aeqqCWvpiBiYQ3jxSr91uiDvmrkyHRdYLUj
831n9L81uNCaPgtUJfaHh89gmdvXKAmSt5Gdsw2g1iPWaPkAHW5Nm4C
832n9KiYM9CgngLvtRCQHZwgC2gjpdaZcCcbt3VboxiNFcKuwFVujzS
833n9LdgEtkmGB9E2h3K4Vp7iGUaKuq23Zr32ehxiU8FWY7xoxbWTSA
836nHB1X37qrniVugfQcuBTAjswphC1drx7QjFFojJPZwKHHnt8kU7v
837nHUkAWDR4cB8AgPg7VXMX6et8xRTQb2KJfgv1aBEXozwrawRKgMB
839[validator_list_sites]
841trustthesevalidators.gov
844021A99A537FDEBC34E4FCA03B39BEADD04299BB19E85097EC92B15A3518801E566
847 *
this,
"test_cfg",
"validators.cfg");
865 boost::format cc(R
"rippleConfig(
869[validator_list_threshold]
874 *
this,
"test_cfg",
"validators.cfg");
876 auto const expectedError =
877 "Config section [validator_list_threshold] should contain "
889 BEAST_EXPECT(error == expectedError);
896 boost::format cc(
"[validators_file]\n%1%\n");
899 *
this,
"test_cfg",
"validators.cfg");
901 auto const expectedError =
902 "The file specified in [validators_file] does not contain a "
903 "[validators], [validator_keys] or [validator_list_keys] "
916 BEAST_EXPECT(error == expectedError);
924 *
this,
"testSetup", explicitPath ?
"test_db" :
"",
"");
936 BEAST_EXPECT(!config.
quiet());
937 BEAST_EXPECT(!config.
silent());
940 BEAST_EXPECT(!config.
legacy(
"database_path").empty());
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());
993 config.
legacy(
"database_path").empty() == !explicitPath);
1002 BEAST_EXPECT(config.
quiet());
1003 BEAST_EXPECT(!config.
silent());
1007 config.
legacy(
"database_path").empty() == !explicitPath);
1016 BEAST_EXPECT(config.
quiet());
1017 BEAST_EXPECT(config.
silent());
1021 config.
legacy(
"database_path").empty() == !explicitPath);
1030 BEAST_EXPECT(config.
quiet());
1031 BEAST_EXPECT(config.
silent());
1035 config.
legacy(
"database_path").empty() == !explicitPath);
1043 auto const& conf = cfg.
config();
1044 if (!BEAST_EXPECT(conf.exists(
"port_rpc")))
1046 if (!BEAST_EXPECT(conf.exists(
"port_wss_admin")))
1069 *
this,
"testPort",
"",
"",
true, contents);
1070 BEAST_EXPECT(
false);
1075 "Invalid value '0' for key 'port'"));
1112 cfg.exists(SECTION_IPS) &&
1113 cfg.section(SECTION_IPS).lines().size() == 1 &&
1114 cfg.section(SECTION_IPS).values().size() == 1);
1116 cfg.exists(SECTION_IPS_FIXED) &&
1117 cfg.section(SECTION_IPS_FIXED).lines().size() == 2 &&
1118 cfg.section(SECTION_IPS_FIXED).values().size() == 2);
1147 anotherserversansport
1148 anotherserverwithport:12
1158 2001:db8:3333:4444:5555:6666:7777:8888:12345
1159 [2001:db8:3333:4444:5555:6666:7777:8888]:1
1168 cfg.
exists(SECTION_IPS) &&
1172 cfg.
exists(SECTION_IPS_FIXED) &&
1175 BEAST_EXPECT(cfg.
IPS[0] ==
"r.ripple.com 51235");
1177 BEAST_EXPECT(cfg.
IPS_FIXED[0] ==
"s1.ripple.com 51235");
1178 BEAST_EXPECT(cfg.
IPS_FIXED[1] ==
"s2.ripple.com 51235");
1179 BEAST_EXPECT(cfg.
IPS_FIXED[2] ==
"anotherserversansport");
1180 BEAST_EXPECT(cfg.
IPS_FIXED[3] ==
"anotherserverwithport 12");
1181 BEAST_EXPECT(cfg.
IPS_FIXED[4] ==
"1.1.1.1 1");
1182 BEAST_EXPECT(cfg.
IPS_FIXED[5] ==
"1.1.1.1 1");
1183 BEAST_EXPECT(cfg.
IPS_FIXED[6] ==
"12.34.12.123 12345");
1184 BEAST_EXPECT(cfg.
IPS_FIXED[7] ==
"12.34.12.123 12345");
1188 BEAST_EXPECT(cfg.
IPS_FIXED[9] ==
"2001:db8::");
1189 BEAST_EXPECT(cfg.
IPS_FIXED[10] ==
"::1");
1190 BEAST_EXPECT(cfg.
IPS_FIXED[11] ==
"::1:12345");
1191 BEAST_EXPECT(cfg.
IPS_FIXED[12] ==
"[::1]:12345");
1194 "2001:db8:3333:4444:5555:6666:7777:8888:12345");
1196 cfg.
IPS_FIXED[14] ==
"[2001:db8:3333:4444:5555:6666:7777:8888]:1");
1202 struct TestCommentData
1211 {{
"password = aaaa\\#bbbb",
"password",
"aaaa#bbbb",
false},
1212 {
"password = aaaa#bbbb",
"password",
"aaaa",
true},
1213 {
"password = aaaa #bbbb",
"password",
"aaaa",
true},
1215 {
"password = #aaaa #bbbb",
"",
"password =",
true},
1216 {
"password = aaaa\\# #bbbb",
"password",
"aaaa#",
true},
1217 {
"password = aaaa\\##bbbb",
"password",
"aaaa#",
true},
1218 {
"aaaa#bbbb",
"",
"aaaa",
true},
1219 {
"aaaa\\#bbbb",
"",
"aaaa#bbbb",
false},
1220 {
"aaaa\\##bbbb",
"",
"aaaa#",
true},
1221 {
"aaaa #bbbb",
"",
"aaaa",
true},
1222 {
"1 #comment",
"",
"1",
true},
1223 {
"#whole thing is comment",
"",
"",
false},
1224 {
" #whole comment with space",
"",
"",
false}}};
1226 for (
auto const& t : tests)
1229 s.append(t.line.data());
1230 BEAST_EXPECT(s.had_trailing_comments() == t.had_comment);
1231 if (t.field.empty())
1233 BEAST_EXPECTS(s.legacy() == t.expect, s.legacy());
1238 BEAST_EXPECTS(
set(field, t.field.data(), s), t.line);
1239 BEAST_EXPECTS(field == t.expect, t.line);
1245 s.append(
"online_delete = 3000");
1247 BEAST_EXPECT(
set(od,
"online_delete", s));
1248 BEAST_EXPECTS(od == 3000, *(s.get<
std::string>(
"online_delete")));
1253 s.append(
"online_delete = 2000 #my comment on this");
1255 BEAST_EXPECT(
set(od,
"online_delete", s));
1256 BEAST_EXPECTS(od == 2000, *(s.get<
std::string>(
"online_delete")));
1263 using namespace std::string_literals;
1264 Section s{
"MySection"};
1265 s.append(
"a_string = mystring");
1266 s.append(
"positive_int = 2");
1267 s.append(
"negative_int = -3");
1268 s.append(
"bool_ish = 1");
1271 auto val_1 =
"value 1"s;
1272 BEAST_EXPECT(
set(val_1,
"a_string", s));
1273 BEAST_EXPECT(val_1 ==
"mystring");
1275 auto val_2 =
"value 2"s;
1276 BEAST_EXPECT(!
set(val_2,
"not_a_key", s));
1277 BEAST_EXPECT(val_2 ==
"value 2");
1278 BEAST_EXPECT(!
set(val_2,
"default"s,
"not_a_key", s));
1279 BEAST_EXPECT(val_2 ==
"default");
1281 auto val_3 = get<std::string>(s,
"a_string");
1282 BEAST_EXPECT(val_3 ==
"mystring");
1283 auto val_4 = get<std::string>(s,
"not_a_key");
1284 BEAST_EXPECT(val_4 ==
"");
1285 auto val_5 = get<std::string>(s,
"not_a_key",
"default");
1286 BEAST_EXPECT(val_5 ==
"default");
1288 auto val_6 =
"value 6"s;
1290 BEAST_EXPECT(val_6 ==
"mystring");
1292 auto val_7 =
"value 7"s;
1294 BEAST_EXPECT(val_7 ==
"value 7");
1299 BEAST_EXPECT(
set(val_1,
"positive_int", s));
1300 BEAST_EXPECT(val_1 == 2);
1303 BEAST_EXPECT(
set(val_2,
"negative_int", s));
1304 BEAST_EXPECT(val_2 == -3);
1307 BEAST_EXPECT(!
set(val_3,
"a_string", s));
1308 BEAST_EXPECT(val_3 == 3);
1310 auto val_4 = get<int>(s,
"positive_int");
1311 BEAST_EXPECT(val_4 == 2);
1312 auto val_5 = get<int>(s,
"not_a_key");
1313 BEAST_EXPECT(val_5 == 0);
1314 auto val_6 = get<int>(s,
"not_a_key", 5);
1315 BEAST_EXPECT(val_6 == 5);
1316 auto val_7 = get<int>(s,
"a_string", 6);
1317 BEAST_EXPECT(val_7 == 6);
1321 BEAST_EXPECT(val_8 == 2);
1325 BEAST_EXPECT(val_9 == 9);
1329 BEAST_EXPECT(val_10 == 10);
1334 s.get<
int>(
"a_string");
1337 catch (boost::bad_lexical_cast&)
1344 bool flag_1 =
false;
1346 BEAST_EXPECT(flag_1 ==
true);
1348 bool flag_2 =
false;
1350 BEAST_EXPECT(flag_2 ==
false);
1367 {
"seconds", 1, 15 * 60,
false},
1368 {
"minutes", 60, 14,
false},
1369 {
"minutes", 60, 15,
true},
1370 {
"hours", 3600, 10,
true},
1371 {
"days", 86400, 10,
true},
1372 {
"weeks", 604800, 2,
true},
1373 {
"months", 2592000, 1,
false},
1374 {
"years", 31536000, 1,
false}};
1377 for (
auto& [unit, sec, val, shouldPass] : units)
1381[amendment_majority_time]
1388 c.loadFromString(toLoad);
1391 c.AMENDMENT_MAJORITY_TIME.count() == val * sec);
1415 c.loadFromString(
"[overlay]\nmax_unknown_time=" + value);
1416 return c.MAX_UNKNOWN_TIME;
1425 BEAST_EXPECT(!testUnknown(
"none"));
1426 BEAST_EXPECT(!testUnknown(
"0.5"));
1427 BEAST_EXPECT(!testUnknown(
"180 seconds"));
1428 BEAST_EXPECT(!testUnknown(
"9 minutes"));
1431 BEAST_EXPECT(!testUnknown(
"299"));
1440 BEAST_EXPECT(!testUnknown(
"1801"));
1460 BEAST_EXPECT(!testDiverged(
"none"));
1461 BEAST_EXPECT(!testDiverged(
"0.5"));
1462 BEAST_EXPECT(!testDiverged(
"180 seconds"));
1463 BEAST_EXPECT(!testDiverged(
"9 minutes"));
1466 BEAST_EXPECT(!testDiverged(
"0"));
1467 BEAST_EXPECT(!testDiverged(
"59"));
1476 BEAST_EXPECT(!testDiverged(
"901"));
1500BEAST_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="")
Create a directory and remove it when it's done.
auto rmDir(path const &toRm)
boost::filesystem::path path
path const & subdir() const
beast::unit_test::suite & test_
Write a file in a directory and remove when done.
path const & file() const
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)
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