@@ -995,29 +995,32 @@ TEST_F(DefaultCacheImplTest, InternalKeysBypassLru) {
995995 SCOPED_TRACE (" Protect and release keys, which suppose to be evicted" );
996996
997997 const auto internal_key{" internal::protected::protected_data" };
998+ const auto data_string{" this is key's data" };
998999 cache::CacheSettings settings;
9991000 settings.disk_path_mutable = cache_path_;
10001001 settings.max_disk_storage = 2u * 1024u * 1024u ;
10011002 {
1003+ settings.eviction_policy = cache::EvictionPolicy::kNone ;
10021004 DefaultCacheImplHelper cache (settings);
10031005 ASSERT_EQ (olp::cache::DefaultCache::Success, cache.Open ());
10041006 cache.Clear ();
1005- const std::string key{" somekey" };
1006- std::string data_string{" this is key's data" };
10071007
10081008 constexpr auto expiry = 2 ;
1009- EXPECT_TRUE (cache.Put (key , data_string,
1009+ EXPECT_TRUE (cache.Put (internal_key , data_string,
10101010 [data_string]() { return data_string; }, expiry));
1011- ASSERT_TRUE (cache.Protect ({key}));
10121011 }
10131012
10141013 settings.disk_path_mutable = cache_path_;
10151014 settings.disk_path_protected .reset ();
1015+ settings.eviction_policy = cache::EvictionPolicy::kLeastRecentlyUsed ;
10161016
10171017 DefaultCacheImplHelper cache (settings);
10181018 ASSERT_EQ (olp::cache::DefaultCache::Success, cache.Open ());
10191019 // no keys was evicted
1020- EXPECT_TRUE (cache.Get (internal_key));
1020+ auto stored_dats = cache.Get (internal_key);
1021+ ASSERT_TRUE (stored_dats);
1022+ std::string stored_string (reinterpret_cast <const char *>(stored_dats->data ()), stored_dats->size ());
1023+ EXPECT_EQ (stored_string, data_string);
10211024 cache.Clear ();
10221025 }
10231026}
0 commit comments