| 1222 | } |
| 1223 | |
| 1224 | void resetTestRun(Driver& cache) { |
| 1225 | std::vector<CacheEntry> log; |
| 1226 | BufferGen bg; |
| 1227 | // Fill up the first region and write one entry into the second region |
| 1228 | for (size_t i = 0; i < 17; i++) { |
| 1229 | CacheEntry e{bg.gen(8), bg.gen(800)}; |
| 1230 | EXPECT_EQ(Status::Ok, |
| 1231 | cache.insertAsync(e.key(), e.value(), nullptr, 0 /* poolId */, |
| 1232 | 0 /* expiryTime */)); |
| 1233 | log.push_back(std::move(e)); |
| 1234 | } |
| 1235 | cache.flush(); |
| 1236 | for (size_t i = 0; i < 17; i++) { |
| 1237 | Buffer value; |
| 1238 | uint32_t lat = 0; |
| 1239 | EXPECT_EQ(Status::Ok, cache.lookup(log[i].key(), value, lat)); |
| 1240 | EXPECT_EQ(log[i].value(), value.view()); |
| 1241 | } |
| 1242 | } |
| 1243 | } // namespace |
| 1244 | |
| 1245 | TEST(BlockCache, Reset) { |