mirror of
https://github.com/XRPLF/clio.git
synced 2025-12-06 17:27:58 +00:00
fix: CacheLoader causes crash when no cache is used (#1853)
If cache is disabled or Clio starts with and empty DB, `loader_` inside cache is not created. So calling `CacheLoader::stop()` or `CacheLoader::wait()` was causing crash.
This commit is contained in:
@@ -270,3 +270,18 @@ TEST_F(CacheLoaderTest, DisabledCacheLoaderDoesNotLoadCache)
|
||||
|
||||
loader.load(kSEQ);
|
||||
}
|
||||
|
||||
TEST_F(CacheLoaderTest, DisabledCacheLoaderCanCallStopAndWait)
|
||||
{
|
||||
auto const cfg = getParseCacheConfig(json::parse(R"({"cache": {"load": "none"}})"));
|
||||
CacheLoader loader{cfg, backend_, cache};
|
||||
|
||||
EXPECT_CALL(cache, updateImp).Times(0);
|
||||
EXPECT_CALL(cache, isFull).WillRepeatedly(Return(false));
|
||||
EXPECT_CALL(cache, setDisabled).Times(1);
|
||||
|
||||
loader.load(kSEQ);
|
||||
|
||||
EXPECT_NO_THROW(loader.stop());
|
||||
EXPECT_NO_THROW(loader.wait());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user