Files
clio/tests/unit/etl/CorruptionDetectorTests.cpp
2026-03-24 15:25:32 +00:00

28 lines
680 B
C++

#include "etl/CorruptionDetector.hpp"
#include "etl/SystemState.hpp"
#include "util/MockLedgerCache.hpp"
#include "util/MockPrometheus.hpp"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
using namespace data;
using namespace util::prometheus;
using namespace testing;
struct CorruptionDetectorTest : WithPrometheus {};
TEST_F(CorruptionDetectorTest, DisableCacheOnCorruption)
{
using namespace ripple;
auto state = etl::SystemState{};
auto cache = MockLedgerCache{};
auto detector = etl::CorruptionDetector{state, cache};
EXPECT_CALL(cache, setDisabled()).Times(1);
detector.onCorruptionDetected();
EXPECT_TRUE(state.isCorruptionDetected);
}