mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-20 11:45:53 +00:00
@@ -310,7 +310,8 @@ TEST_F(MigrationCassandraManagerLedgerTableTest, MigrateExampleLedgerMigrator)
|
|||||||
EXPECT_EQ(newTableSize, gLedgerHeaderRawData.size());
|
EXPECT_EQ(newTableSize, gLedgerHeaderRawData.size());
|
||||||
|
|
||||||
auto const getAccountHash = [this](std::uint32_t seq) {
|
auto const getAccountHash = [this](std::uint32_t seq) {
|
||||||
return data::synchronous([&](auto ctx) { return testMigrationBackend_->fetchAccountHashViaSequence(seq, ctx); });
|
return data::synchronous([&](auto ctx) { return testMigrationBackend_->fetchAccountHashViaSequence(seq, ctx); }
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
EXPECT_EQ(
|
EXPECT_EQ(
|
||||||
|
|||||||
@@ -649,11 +649,13 @@ generateNormalPathBookOffersTestBundles()
|
|||||||
.testName = "PaysUSDGetsXRPNoFrozenOwnerFundEnough",
|
.testName = "PaysUSDGetsXRPNoFrozenOwnerFundEnough",
|
||||||
.inputJson = getsXRPPaysUSDInputJson,
|
.inputJson = getsXRPPaysUSDInputJson,
|
||||||
// prepare offer dir index
|
// prepare offer dir index
|
||||||
.mockedSuccessors=std::map<ripple::uint256, std::optional<ripple::uint256>>{
|
.mockedSuccessors =
|
||||||
|
std::map<ripple::uint256, std::optional<ripple::uint256>>{
|
||||||
{getsXRPPaysUSDBook, ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR}},
|
{getsXRPPaysUSDBook, ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR}},
|
||||||
{ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR}, std::optional<ripple::uint256>{}}
|
{ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR}, std::optional<ripple::uint256>{}}
|
||||||
},
|
},
|
||||||
.mockedLedgerObjects=std::map<ripple::uint256, ripple::Blob>{
|
.mockedLedgerObjects =
|
||||||
|
std::map<ripple::uint256, ripple::Blob>{
|
||||||
// book dir object
|
// book dir object
|
||||||
{ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR},
|
{ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR},
|
||||||
createOwnerDirLedgerObject({ripple::uint256{kINDEX2}}, kINDEX1).getSerializer().peekData()},
|
createOwnerDirLedgerObject({ripple::uint256{kINDEX2}}, kINDEX1).getSerializer().peekData()},
|
||||||
@@ -707,11 +709,13 @@ generateNormalPathBookOffersTestBundles()
|
|||||||
.testName = "PaysUSDGetsXRPNoFrozenOwnerFundNotEnough",
|
.testName = "PaysUSDGetsXRPNoFrozenOwnerFundNotEnough",
|
||||||
.inputJson = getsXRPPaysUSDInputJson,
|
.inputJson = getsXRPPaysUSDInputJson,
|
||||||
// prepare offer dir index
|
// prepare offer dir index
|
||||||
.mockedSuccessors=std::map<ripple::uint256, std::optional<ripple::uint256>>{
|
.mockedSuccessors =
|
||||||
|
std::map<ripple::uint256, std::optional<ripple::uint256>>{
|
||||||
{getsXRPPaysUSDBook, ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR}},
|
{getsXRPPaysUSDBook, ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR}},
|
||||||
{ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR}, std::optional<ripple::uint256>{}}
|
{ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR}, std::optional<ripple::uint256>{}}
|
||||||
},
|
},
|
||||||
.mockedLedgerObjects=std::map<ripple::uint256, ripple::Blob>{
|
.mockedLedgerObjects =
|
||||||
|
std::map<ripple::uint256, ripple::Blob>{
|
||||||
// book dir object
|
// book dir object
|
||||||
{ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR},
|
{ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR},
|
||||||
createOwnerDirLedgerObject({ripple::uint256{kINDEX2}}, kINDEX1).getSerializer().peekData()},
|
createOwnerDirLedgerObject({ripple::uint256{kINDEX2}}, kINDEX1).getSerializer().peekData()},
|
||||||
@@ -772,11 +776,13 @@ generateNormalPathBookOffersTestBundles()
|
|||||||
.testName = "PaysUSDGetsXRPFrozen",
|
.testName = "PaysUSDGetsXRPFrozen",
|
||||||
.inputJson = getsXRPPaysUSDInputJson,
|
.inputJson = getsXRPPaysUSDInputJson,
|
||||||
// prepare offer dir index
|
// prepare offer dir index
|
||||||
.mockedSuccessors=std::map<ripple::uint256, std::optional<ripple::uint256>>{
|
.mockedSuccessors =
|
||||||
|
std::map<ripple::uint256, std::optional<ripple::uint256>>{
|
||||||
{getsXRPPaysUSDBook, ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR}},
|
{getsXRPPaysUSDBook, ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR}},
|
||||||
{ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR}, std::optional<ripple::uint256>{}}
|
{ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR}, std::optional<ripple::uint256>{}}
|
||||||
},
|
},
|
||||||
.mockedLedgerObjects=std::map<ripple::uint256, ripple::Blob>{
|
.mockedLedgerObjects =
|
||||||
|
std::map<ripple::uint256, ripple::Blob>{
|
||||||
// book dir object
|
// book dir object
|
||||||
{ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR},
|
{ripple::uint256{kPAYS20_USD_GETS10_XRP_BOOK_DIR},
|
||||||
createOwnerDirLedgerObject({ripple::uint256{kINDEX2}}, kINDEX1).getSerializer().peekData()},
|
createOwnerDirLedgerObject({ripple::uint256{kINDEX2}}, kINDEX1).getSerializer().peekData()},
|
||||||
@@ -832,17 +838,21 @@ generateNormalPathBookOffersTestBundles()
|
|||||||
.testName = "GetsUSDPaysXRPFrozen",
|
.testName = "GetsUSDPaysXRPFrozen",
|
||||||
.inputJson = paysXRPGetsUSDInputJson,
|
.inputJson = paysXRPGetsUSDInputJson,
|
||||||
// prepare offer dir index
|
// prepare offer dir index
|
||||||
.mockedSuccessors=std::map<ripple::uint256, std::optional<ripple::uint256>>{
|
.mockedSuccessors =
|
||||||
|
std::map<ripple::uint256, std::optional<ripple::uint256>>{
|
||||||
{getsUSDPaysXRPBook, ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}},
|
{getsUSDPaysXRPBook, ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}},
|
||||||
{ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}, std::optional<ripple::uint256>{}}
|
{ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}, std::optional<ripple::uint256>{}}
|
||||||
},
|
},
|
||||||
.mockedLedgerObjects=std::map<ripple::uint256, ripple::Blob>{
|
.mockedLedgerObjects =
|
||||||
|
std::map<ripple::uint256, ripple::Blob>{
|
||||||
// book dir object
|
// book dir object
|
||||||
{ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR},
|
{ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR},
|
||||||
createOwnerDirLedgerObject({ripple::uint256{kINDEX2}}, kINDEX1).getSerializer().peekData()},
|
createOwnerDirLedgerObject({ripple::uint256{kINDEX2}}, kINDEX1).getSerializer().peekData()},
|
||||||
// gets issuer account object
|
// gets issuer account object
|
||||||
{ripple::keylet::account(account).key,
|
{ripple::keylet::account(account).key,
|
||||||
createAccountRootObject(kACCOUNT, ripple::lsfGlobalFreeze, 2, 200, 2, kINDEX1, 2, kTRANSFER_RATE_X2)
|
createAccountRootObject(
|
||||||
|
kACCOUNT, ripple::lsfGlobalFreeze, 2, 200, 2, kINDEX1, 2, kTRANSFER_RATE_X2
|
||||||
|
)
|
||||||
.getSerializer()
|
.getSerializer()
|
||||||
.peekData()}
|
.peekData()}
|
||||||
},
|
},
|
||||||
@@ -893,11 +903,13 @@ generateNormalPathBookOffersTestBundles()
|
|||||||
.testName = "PaysXRPGetsUSDWithTransferFee",
|
.testName = "PaysXRPGetsUSDWithTransferFee",
|
||||||
.inputJson = paysXRPGetsUSDInputJson,
|
.inputJson = paysXRPGetsUSDInputJson,
|
||||||
// prepare offer dir index
|
// prepare offer dir index
|
||||||
.mockedSuccessors=std::map<ripple::uint256, std::optional<ripple::uint256>>{
|
.mockedSuccessors =
|
||||||
|
std::map<ripple::uint256, std::optional<ripple::uint256>>{
|
||||||
{getsUSDPaysXRPBook, ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}},
|
{getsUSDPaysXRPBook, ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}},
|
||||||
{ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}, std::optional<ripple::uint256>{}}
|
{ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}, std::optional<ripple::uint256>{}}
|
||||||
},
|
},
|
||||||
.mockedLedgerObjects=std::map<ripple::uint256, ripple::Blob>{
|
.mockedLedgerObjects =
|
||||||
|
std::map<ripple::uint256, ripple::Blob>{
|
||||||
// book dir object
|
// book dir object
|
||||||
{ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR},
|
{ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR},
|
||||||
createOwnerDirLedgerObject({ripple::uint256{kINDEX2}}, kINDEX1).getSerializer().peekData()},
|
createOwnerDirLedgerObject({ripple::uint256{kINDEX2}}, kINDEX1).getSerializer().peekData()},
|
||||||
@@ -957,11 +969,13 @@ generateNormalPathBookOffersTestBundles()
|
|||||||
.testName = "PaysXRPGetsUSDWithMultipleOffers",
|
.testName = "PaysXRPGetsUSDWithMultipleOffers",
|
||||||
.inputJson = paysXRPGetsUSDInputJson,
|
.inputJson = paysXRPGetsUSDInputJson,
|
||||||
// prepare offer dir index
|
// prepare offer dir index
|
||||||
.mockedSuccessors=std::map<ripple::uint256, std::optional<ripple::uint256>>{
|
.mockedSuccessors =
|
||||||
|
std::map<ripple::uint256, std::optional<ripple::uint256>>{
|
||||||
{getsUSDPaysXRPBook, ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}},
|
{getsUSDPaysXRPBook, ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}},
|
||||||
{ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}, std::optional<ripple::uint256>{}}
|
{ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}, std::optional<ripple::uint256>{}}
|
||||||
},
|
},
|
||||||
.mockedLedgerObjects=std::map<ripple::uint256, ripple::Blob>{
|
.mockedLedgerObjects =
|
||||||
|
std::map<ripple::uint256, ripple::Blob>{
|
||||||
// book dir object
|
// book dir object
|
||||||
{ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR},
|
{ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR},
|
||||||
createOwnerDirLedgerObject({ripple::uint256{kINDEX2}, ripple::uint256{kINDEX2}}, kINDEX1)
|
createOwnerDirLedgerObject({ripple::uint256{kINDEX2}, ripple::uint256{kINDEX2}}, kINDEX1)
|
||||||
@@ -977,7 +991,8 @@ generateNormalPathBookOffersTestBundles()
|
|||||||
trustline30Balance.getSerializer().peekData()},
|
trustline30Balance.getSerializer().peekData()},
|
||||||
},
|
},
|
||||||
.ledgerObjectCalls = 6,
|
.ledgerObjectCalls = 6,
|
||||||
.mockedOffers=std::vector<ripple::STObject>{// After offer1, balance is 30 - 2*10 = 10
|
.mockedOffers =
|
||||||
|
std::vector<ripple::STObject>{// After offer1, balance is 30 - 2*10 = 10
|
||||||
gets10USDPays20XRPOffer,
|
gets10USDPays20XRPOffer,
|
||||||
// offer2 not fully funded, balance is 10, rate is 2, so only
|
// offer2 not fully funded, balance is 10, rate is 2, so only
|
||||||
// gets 5
|
// gets 5
|
||||||
@@ -1050,11 +1065,13 @@ generateNormalPathBookOffersTestBundles()
|
|||||||
.testName = "PaysXRPGetsUSDSellingOwnCurrency",
|
.testName = "PaysXRPGetsUSDSellingOwnCurrency",
|
||||||
.inputJson = paysXRPGetsUSDInputJson,
|
.inputJson = paysXRPGetsUSDInputJson,
|
||||||
// prepare offer dir index
|
// prepare offer dir index
|
||||||
.mockedSuccessors=std::map<ripple::uint256, std::optional<ripple::uint256>>{
|
.mockedSuccessors =
|
||||||
|
std::map<ripple::uint256, std::optional<ripple::uint256>>{
|
||||||
{getsUSDPaysXRPBook, ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}},
|
{getsUSDPaysXRPBook, ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}},
|
||||||
{ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}, std::optional<ripple::uint256>{}}
|
{ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}, std::optional<ripple::uint256>{}}
|
||||||
},
|
},
|
||||||
.mockedLedgerObjects=std::map<ripple::uint256, ripple::Blob>{
|
.mockedLedgerObjects =
|
||||||
|
std::map<ripple::uint256, ripple::Blob>{
|
||||||
// book dir object
|
// book dir object
|
||||||
{ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR},
|
{ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR},
|
||||||
createOwnerDirLedgerObject({ripple::uint256{kINDEX2}}, kINDEX1).getSerializer().peekData()},
|
createOwnerDirLedgerObject({ripple::uint256{kINDEX2}}, kINDEX1).getSerializer().peekData()},
|
||||||
@@ -1105,11 +1122,13 @@ generateNormalPathBookOffersTestBundles()
|
|||||||
.testName = "PaysXRPGetsUSDTrustLineFrozen",
|
.testName = "PaysXRPGetsUSDTrustLineFrozen",
|
||||||
.inputJson = paysXRPGetsUSDInputJson,
|
.inputJson = paysXRPGetsUSDInputJson,
|
||||||
// prepare offer dir index
|
// prepare offer dir index
|
||||||
.mockedSuccessors=std::map<ripple::uint256, std::optional<ripple::uint256>>{
|
.mockedSuccessors =
|
||||||
|
std::map<ripple::uint256, std::optional<ripple::uint256>>{
|
||||||
{getsUSDPaysXRPBook, ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}},
|
{getsUSDPaysXRPBook, ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}},
|
||||||
{ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}, std::optional<ripple::uint256>{}}
|
{ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR}, std::optional<ripple::uint256>{}}
|
||||||
},
|
},
|
||||||
.mockedLedgerObjects=std::map<ripple::uint256, ripple::Blob>{
|
.mockedLedgerObjects =
|
||||||
|
std::map<ripple::uint256, ripple::Blob>{
|
||||||
// book dir object
|
// book dir object
|
||||||
{ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR},
|
{ripple::uint256{kPAYS20_XRP_GETS10_USD_BOOK_DIR},
|
||||||
createOwnerDirLedgerObject({ripple::uint256{kINDEX2}}, kINDEX1).getSerializer().peekData()},
|
createOwnerDirLedgerObject({ripple::uint256{kINDEX2}}, kINDEX1).getSerializer().peekData()},
|
||||||
|
|||||||
@@ -454,7 +454,9 @@ generateNormalPathTestBundles()
|
|||||||
ripple::uint256{kINDEX2}},
|
ripple::uint256{kINDEX2}},
|
||||||
kINDEX1
|
kINDEX1
|
||||||
),
|
),
|
||||||
.mockedObjects=std::vector{// hotwallet
|
.mockedObjects =
|
||||||
|
std::vector{
|
||||||
|
// hotwallet
|
||||||
createRippleStateLedgerObject("USD", kISSUER, -10, kACCOUNT, 100, kACCOUNT2, 200, kTXN_ID, 123),
|
createRippleStateLedgerObject("USD", kISSUER, -10, kACCOUNT, 100, kACCOUNT2, 200, kTXN_ID, 123),
|
||||||
// hotwallet
|
// hotwallet
|
||||||
createRippleStateLedgerObject("CNY", kISSUER, -20, kACCOUNT, 100, kACCOUNT2, 200, kTXN_ID, 123),
|
createRippleStateLedgerObject("CNY", kISSUER, -20, kACCOUNT, 100, kACCOUNT2, 200, kTXN_ID, 123),
|
||||||
@@ -518,7 +520,9 @@ generateNormalPathTestBundles()
|
|||||||
NormalTestBundle{
|
NormalTestBundle{
|
||||||
.testName = "NoHotwallet",
|
.testName = "NoHotwallet",
|
||||||
.mockedDir = createOwnerDirLedgerObject({ripple::uint256{kINDEX2}}, kINDEX1),
|
.mockedDir = createOwnerDirLedgerObject({ripple::uint256{kINDEX2}}, kINDEX1),
|
||||||
.mockedObjects=std::vector{createRippleStateLedgerObject("JPY", kISSUER, -50, kACCOUNT, 10, kACCOUNT3, 20, kTXN_ID, 123)},
|
.mockedObjects = std::vector{createRippleStateLedgerObject(
|
||||||
|
"JPY", kISSUER, -50, kACCOUNT, 10, kACCOUNT3, 20, kTXN_ID, 123
|
||||||
|
)},
|
||||||
.expectedJson = fmt::format(
|
.expectedJson = fmt::format(
|
||||||
R"({{
|
R"({{
|
||||||
"obligations":{{
|
"obligations":{{
|
||||||
@@ -556,7 +560,9 @@ generateNormalPathTestBundles()
|
|||||||
},
|
},
|
||||||
kINDEX1
|
kINDEX1
|
||||||
),
|
),
|
||||||
.mockedObjects=std::vector{// hotwallet
|
.mockedObjects =
|
||||||
|
std::vector{
|
||||||
|
// hotwallet
|
||||||
createRippleStateLedgerObject("USD", kISSUER, 10, kACCOUNT2, 100, kACCOUNT, 200, kTXN_ID, 123),
|
createRippleStateLedgerObject("USD", kISSUER, 10, kACCOUNT2, 100, kACCOUNT, 200, kTXN_ID, 123),
|
||||||
// hotwallet
|
// hotwallet
|
||||||
createRippleStateLedgerObject("CNY", kISSUER, 20, kACCOUNT2, 100, kACCOUNT, 200, kTXN_ID, 123),
|
createRippleStateLedgerObject("CNY", kISSUER, 20, kACCOUNT2, 100, kACCOUNT, 200, kTXN_ID, 123),
|
||||||
@@ -603,7 +609,8 @@ generateNormalPathTestBundles()
|
|||||||
.mockedDir = createOwnerDirLedgerObject(
|
.mockedDir = createOwnerDirLedgerObject(
|
||||||
{ripple::uint256{kINDEX2}, ripple::uint256{kINDEX2}, ripple::uint256{kINDEX2}}, kINDEX1
|
{ripple::uint256{kINDEX2}, ripple::uint256{kINDEX2}, ripple::uint256{kINDEX2}}, kINDEX1
|
||||||
),
|
),
|
||||||
.mockedObjects=std::vector{
|
.mockedObjects =
|
||||||
|
std::vector{
|
||||||
createRippleStateLedgerObject("USD", kISSUER, -10, kACCOUNT, 100, kACCOUNT2, 200, kTXN_ID, 123),
|
createRippleStateLedgerObject("USD", kISSUER, -10, kACCOUNT, 100, kACCOUNT2, 200, kTXN_ID, 123),
|
||||||
createRippleStateLedgerObject("CNY", kISSUER, -20, kACCOUNT, 100, kACCOUNT2, 200, kTXN_ID, 123),
|
createRippleStateLedgerObject("CNY", kISSUER, -20, kACCOUNT, 100, kACCOUNT2, 200, kTXN_ID, 123),
|
||||||
createRippleStateLedgerObject("EUR", kISSUER, -30, kACCOUNT, 100, kACCOUNT3, 200, kTXN_ID, 123)
|
createRippleStateLedgerObject("EUR", kISSUER, -30, kACCOUNT, 100, kACCOUNT3, 200, kTXN_ID, 123)
|
||||||
|
|||||||
@@ -130,12 +130,30 @@ public:
|
|||||||
{
|
{
|
||||||
// start from 2024-06-25T12:23:10Z to 2024-06-25T12:23:50Z with step 2
|
// start from 2024-06-25T12:23:10Z to 2024-06-25T12:23:50Z with step 2
|
||||||
return std::vector<LedgerIndexTestsCaseBundle>{
|
return std::vector<LedgerIndexTestsCaseBundle>{
|
||||||
{.testName="LaterThanMaxLedger", .json=R"({"date": "2024-06-25T12:23:55Z"})", .expectedLedgerIndex=kRANGE_MAX, .closeTimeIso="2024-06-25T12:23:50Z"},
|
{.testName = "LaterThanMaxLedger",
|
||||||
{.testName="GreaterThanMinLedger", .json=R"({"date": "2024-06-25T12:23:11Z"})", .expectedLedgerIndex=kRANGE_MIN, .closeTimeIso="2024-06-25T12:23:10Z"},
|
.json = R"({"date": "2024-06-25T12:23:55Z"})",
|
||||||
{.testName="IsMinLedger", .json=R"({"date": "2024-06-25T12:23:10Z"})", .expectedLedgerIndex=kRANGE_MIN, .closeTimeIso="2024-06-25T12:23:10Z"},
|
.expectedLedgerIndex = kRANGE_MAX,
|
||||||
{.testName="IsMaxLedger", .json=R"({"date": "2024-06-25T12:23:50Z"})", .expectedLedgerIndex=kRANGE_MAX, .closeTimeIso="2024-06-25T12:23:50Z"},
|
.closeTimeIso = "2024-06-25T12:23:50Z"},
|
||||||
{.testName="IsMidLedger", .json=R"({"date": "2024-06-25T12:23:30Z"})", .expectedLedgerIndex=20, .closeTimeIso="2024-06-25T12:23:30Z"},
|
{.testName = "GreaterThanMinLedger",
|
||||||
{.testName="BetweenLedgers", .json=R"({"date": "2024-06-25T12:23:29Z"})", .expectedLedgerIndex=19, .closeTimeIso="2024-06-25T12:23:28Z"}
|
.json = R"({"date": "2024-06-25T12:23:11Z"})",
|
||||||
|
.expectedLedgerIndex = kRANGE_MIN,
|
||||||
|
.closeTimeIso = "2024-06-25T12:23:10Z"},
|
||||||
|
{.testName = "IsMinLedger",
|
||||||
|
.json = R"({"date": "2024-06-25T12:23:10Z"})",
|
||||||
|
.expectedLedgerIndex = kRANGE_MIN,
|
||||||
|
.closeTimeIso = "2024-06-25T12:23:10Z"},
|
||||||
|
{.testName = "IsMaxLedger",
|
||||||
|
.json = R"({"date": "2024-06-25T12:23:50Z"})",
|
||||||
|
.expectedLedgerIndex = kRANGE_MAX,
|
||||||
|
.closeTimeIso = "2024-06-25T12:23:50Z"},
|
||||||
|
{.testName = "IsMidLedger",
|
||||||
|
.json = R"({"date": "2024-06-25T12:23:30Z"})",
|
||||||
|
.expectedLedgerIndex = 20,
|
||||||
|
.closeTimeIso = "2024-06-25T12:23:30Z"},
|
||||||
|
{.testName = "BetweenLedgers",
|
||||||
|
.json = R"({"date": "2024-06-25T12:23:29Z"})",
|
||||||
|
.expectedLedgerIndex = 19,
|
||||||
|
.closeTimeIso = "2024-06-25T12:23:28Z"}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -769,7 +769,8 @@ TEST_F(RPCLedgerHandlerTest, DiffNotBinary)
|
|||||||
los.push_back(LedgerObject{.key = ripple::uint256{kINDEX2}, .blob = Blob{}}); // NOLINT(modernize-use-emplace)
|
los.push_back(LedgerObject{.key = ripple::uint256{kINDEX2}, .blob = Blob{}}); // NOLINT(modernize-use-emplace)
|
||||||
los.push_back(LedgerObject{
|
los.push_back(LedgerObject{
|
||||||
.key = ripple::uint256{kINDEX1},
|
.key = ripple::uint256{kINDEX1},
|
||||||
.blob=createAccountRootObject(kACCOUNT, ripple::lsfGlobalFreeze, 1, 10, 2, kINDEX1, 3).getSerializer().peekData()
|
.blob =
|
||||||
|
createAccountRootObject(kACCOUNT, ripple::lsfGlobalFreeze, 1, 10, 2, kINDEX1, 3).getSerializer().peekData()
|
||||||
});
|
});
|
||||||
|
|
||||||
ON_CALL(*backend_, fetchLedgerDiff(kRANGE_MAX, _)).WillByDefault(Return(los));
|
ON_CALL(*backend_, fetchLedgerDiff(kRANGE_MAX, _)).WillByDefault(Return(los));
|
||||||
@@ -812,7 +813,8 @@ TEST_F(RPCLedgerHandlerTest, DiffBinary)
|
|||||||
los.push_back(LedgerObject{.key = ripple::uint256{kINDEX2}, .blob = Blob{}}); // NOLINT(modernize-use-emplace)
|
los.push_back(LedgerObject{.key = ripple::uint256{kINDEX2}, .blob = Blob{}}); // NOLINT(modernize-use-emplace)
|
||||||
los.push_back(LedgerObject{
|
los.push_back(LedgerObject{
|
||||||
.key = ripple::uint256{kINDEX1},
|
.key = ripple::uint256{kINDEX1},
|
||||||
.blob=createAccountRootObject(kACCOUNT, ripple::lsfGlobalFreeze, 1, 10, 2, kINDEX1, 3).getSerializer().peekData()
|
.blob =
|
||||||
|
createAccountRootObject(kACCOUNT, ripple::lsfGlobalFreeze, 1, 10, 2, kINDEX1, 3).getSerializer().peekData()
|
||||||
});
|
});
|
||||||
|
|
||||||
ON_CALL(*backend_, fetchLedgerDiff(kRANGE_MAX, _)).WillByDefault(Return(los));
|
ON_CALL(*backend_, fetchLedgerDiff(kRANGE_MAX, _)).WillByDefault(Return(los));
|
||||||
|
|||||||
@@ -509,7 +509,8 @@ TEST_F(RPCNFTsByIssuerHandlerTest, MarkerParameter)
|
|||||||
|
|
||||||
std::vector<NFT> const nfts = {createNft(kNFT_ID3, kACCOUNT, 29)};
|
std::vector<NFT> const nfts = {createNft(kNFT_ID3, kACCOUNT, 29)};
|
||||||
auto const account = getAccountIdWithString(kACCOUNT);
|
auto const account = getAccountIdWithString(kACCOUNT);
|
||||||
ON_CALL(*backend_, fetchNFTsByIssuer).WillByDefault(Return(NFTsAndCursor{.nfts=nfts, .cursor=ripple::uint256{kNFT_ID3}}));
|
ON_CALL(*backend_, fetchNFTsByIssuer)
|
||||||
|
.WillByDefault(Return(NFTsAndCursor{.nfts = nfts, .cursor = ripple::uint256{kNFT_ID3}}));
|
||||||
EXPECT_CALL(*backend_, fetchNFTsByIssuer(account, _, Const(30), _, Eq(ripple::uint256{kNFT_ID1}), _)).Times(1);
|
EXPECT_CALL(*backend_, fetchNFTsByIssuer(account, _, Const(30), _, Eq(ripple::uint256{kNFT_ID1}), _)).Times(1);
|
||||||
|
|
||||||
auto const input = json::parse(fmt::format(
|
auto const input = json::parse(fmt::format(
|
||||||
|
|||||||
@@ -855,8 +855,13 @@ auto
|
|||||||
generateInvalidVersions()
|
generateInvalidVersions()
|
||||||
{
|
{
|
||||||
return std::vector<InvalidAPIVersionTestBundle>{
|
return std::vector<InvalidAPIVersionTestBundle>{
|
||||||
{.testName="v0", .version="0", .wsMessage=fmt::format("Requested API version is lower than minimum supported ({})", rpc::kAPI_VERSION_MIN)},
|
{.testName = "v0",
|
||||||
{.testName="v4", .version="4", .wsMessage=fmt::format("Requested API version is higher than maximum supported ({})", rpc::kAPI_VERSION_MAX)},
|
.version = "0",
|
||||||
|
.wsMessage = fmt::format("Requested API version is lower than minimum supported ({})", rpc::kAPI_VERSION_MIN)},
|
||||||
|
{.testName = "v4",
|
||||||
|
.version = "4",
|
||||||
|
.wsMessage = fmt::format("Requested API version is higher than maximum supported ({})", rpc::kAPI_VERSION_MAX)
|
||||||
|
},
|
||||||
{.testName = "null", .version = "null", .wsMessage = "API version must be an integer"},
|
{.testName = "null", .version = "null", .wsMessage = "API version must be an integer"},
|
||||||
{.testName = "str", .version = "\"bogus\"", .wsMessage = "API version must be an integer"},
|
{.testName = "str", .version = "\"bogus\"", .wsMessage = "API version must be an integer"},
|
||||||
{.testName = "bool", .version = "false", .wsMessage = "API version must be an integer"},
|
{.testName = "bool", .version = "false", .wsMessage = "API version must be an integer"},
|
||||||
|
|||||||
@@ -69,13 +69,7 @@ struct ConnectionHandlerTest : SyncAsioContextTest {
|
|||||||
: tagFactory{util::config::ClioConfigDefinition{
|
: tagFactory{util::config::ClioConfigDefinition{
|
||||||
{"log_tag_style", config::ConfigValue{config::ConfigType::String}.defaultValue("uint")}
|
{"log_tag_style", config::ConfigValue{config::ConfigType::String}.defaultValue("uint")}
|
||||||
}}
|
}}
|
||||||
, connectionHandler{
|
, connectionHandler{policy, maxParallelConnections, tagFactory, std::nullopt, onDisconnectMock.AsStdFunction()}
|
||||||
policy,
|
|
||||||
maxParallelConnections,
|
|
||||||
tagFactory,
|
|
||||||
std::nullopt,
|
|
||||||
onDisconnectMock.AsStdFunction()
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user