chore: No ALL_CAPS (#1760)

Fixes #1680
This commit is contained in:
Alex Kremer
2025-01-02 11:39:31 +00:00
committed by GitHub
parent efe5d08205
commit 820b32c6d7
361 changed files with 10061 additions and 9724 deletions

View File

@@ -38,13 +38,17 @@ using namespace data;
using namespace util::prometheus;
using namespace testing;
constexpr static auto MAXSEQ = 30;
constexpr static auto MINSEQ = 10;
namespace {
constexpr auto kMAX_SEQ = 30;
constexpr auto kMIN_SEQ = 10;
} // namespace
struct BackendInterfaceTest : WithPrometheus, MockBackendTestNaggy, SyncAsioContextTest {
BackendInterfaceTest()
{
backend->setRange(MINSEQ, MAXSEQ);
backend_->setRange(kMIN_SEQ, kMAX_SEQ);
}
};
@@ -53,11 +57,11 @@ TEST_F(BackendInterfaceTest, FetchFeesSuccessPath)
using namespace ripple;
// New fee setting (after XRPFees amendment)
EXPECT_CALL(*backend, doFetchLedgerObject(keylet::fees().key, MAXSEQ, _))
.WillRepeatedly(Return(CreateFeeSettingBlob(XRPAmount(1), XRPAmount(2), XRPAmount(3), 0)));
EXPECT_CALL(*backend_, doFetchLedgerObject(keylet::fees().key, kMAX_SEQ, _))
.WillRepeatedly(Return(createFeeSettingBlob(XRPAmount(1), XRPAmount(2), XRPAmount(3), 0)));
runSpawn([this](auto yield) {
auto fees = backend->fetchFees(MAXSEQ, yield);
auto fees = backend_->fetchFees(kMAX_SEQ, yield);
EXPECT_TRUE(fees.has_value());
EXPECT_EQ(fees->base, XRPAmount(1));
@@ -71,11 +75,11 @@ TEST_F(BackendInterfaceTest, FetchFeesLegacySuccessPath)
using namespace ripple;
// Legacy fee setting (before XRPFees amendment)
EXPECT_CALL(*backend, doFetchLedgerObject(keylet::fees().key, MAXSEQ, _))
.WillRepeatedly(Return(CreateLegacyFeeSettingBlob(1, 2, 3, 4, 0)));
EXPECT_CALL(*backend_, doFetchLedgerObject(keylet::fees().key, kMAX_SEQ, _))
.WillRepeatedly(Return(createLegacyFeeSettingBlob(1, 2, 3, 4, 0)));
runSpawn([this](auto yield) {
auto fees = backend->fetchFees(MAXSEQ, yield);
auto fees = backend_->fetchFees(kMAX_SEQ, yield);
EXPECT_TRUE(fees.has_value());
EXPECT_EQ(fees->base, XRPAmount(1));
@@ -89,16 +93,16 @@ TEST_F(BackendInterfaceTest, FetchLedgerPageSuccessPath)
using namespace ripple;
auto state = etl::SystemState{};
backend->setCorruptionDetector(etl::CorruptionDetector{state, backend->cache()});
backend_->setCorruptionDetector(etl::CorruptionDetector{state, backend_->cache()});
EXPECT_FALSE(backend->cache().isDisabled());
EXPECT_CALL(*backend, doFetchSuccessorKey(_, _, _))
EXPECT_FALSE(backend_->cache().isDisabled());
EXPECT_CALL(*backend_, doFetchSuccessorKey(_, _, _))
.Times(10)
.WillRepeatedly(Return(uint256{"1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"}));
EXPECT_CALL(*backend, doFetchLedgerObjects(_, _, _)).WillOnce(Return(std::vector<Blob>(10, Blob{'s'})));
EXPECT_CALL(*backend_, doFetchLedgerObjects(_, _, _)).WillOnce(Return(std::vector<Blob>(10, Blob{'s'})));
runSpawn([this](auto yield) { backend->fetchLedgerPage(std::nullopt, MAXSEQ, 10, false, yield); });
EXPECT_FALSE(backend->cache().isDisabled());
runSpawn([this](auto yield) { backend_->fetchLedgerPage(std::nullopt, kMAX_SEQ, 10, false, yield); });
EXPECT_FALSE(backend_->cache().isDisabled());
}
TEST_F(BackendInterfaceTest, FetchLedgerPageDisablesCacheOnMissingData)
@@ -106,34 +110,34 @@ TEST_F(BackendInterfaceTest, FetchLedgerPageDisablesCacheOnMissingData)
using namespace ripple;
auto state = etl::SystemState{};
backend->setCorruptionDetector(etl::CorruptionDetector{state, backend->cache()});
backend_->setCorruptionDetector(etl::CorruptionDetector{state, backend_->cache()});
EXPECT_FALSE(backend->cache().isDisabled());
EXPECT_CALL(*backend, doFetchSuccessorKey(_, _, _))
EXPECT_FALSE(backend_->cache().isDisabled());
EXPECT_CALL(*backend_, doFetchSuccessorKey(_, _, _))
.Times(10)
.WillRepeatedly(Return(uint256{"1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"}));
EXPECT_CALL(*backend, doFetchLedgerObjects(_, _, _))
EXPECT_CALL(*backend_, doFetchLedgerObjects(_, _, _))
.WillOnce(Return(std::vector<Blob>{
Blob{'s'}, Blob{'s'}, Blob{'s'}, Blob{'s'}, Blob{'s'}, Blob{'s'}, Blob{'s'}, Blob{'s'}, Blob{'s'}, Blob{}
}));
runSpawn([this](auto yield) { backend->fetchLedgerPage(std::nullopt, MAXSEQ, 10, false, yield); });
EXPECT_TRUE(backend->cache().isDisabled());
runSpawn([this](auto yield) { backend_->fetchLedgerPage(std::nullopt, kMAX_SEQ, 10, false, yield); });
EXPECT_TRUE(backend_->cache().isDisabled());
}
TEST_F(BackendInterfaceTest, FetchLedgerPageWithoutCorruptionDetectorDoesNotDisableCacheOnMissingData)
{
using namespace ripple;
EXPECT_FALSE(backend->cache().isDisabled());
EXPECT_CALL(*backend, doFetchSuccessorKey(_, _, _))
EXPECT_FALSE(backend_->cache().isDisabled());
EXPECT_CALL(*backend_, doFetchSuccessorKey(_, _, _))
.Times(10)
.WillRepeatedly(Return(uint256{"1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"}));
EXPECT_CALL(*backend, doFetchLedgerObjects(_, _, _))
EXPECT_CALL(*backend_, doFetchLedgerObjects(_, _, _))
.WillOnce(Return(std::vector<Blob>{
Blob{'s'}, Blob{'s'}, Blob{'s'}, Blob{'s'}, Blob{'s'}, Blob{'s'}, Blob{'s'}, Blob{'s'}, Blob{'s'}, Blob{}
}));
runSpawn([this](auto yield) { backend->fetchLedgerPage(std::nullopt, MAXSEQ, 10, false, yield); });
EXPECT_FALSE(backend->cache().isDisabled());
runSpawn([this](auto yield) { backend_->fetchLedgerPage(std::nullopt, kMAX_SEQ, 10, false, yield); });
EXPECT_FALSE(backend_->cache().isDisabled());
}