MCPcopy Create free account
hub / github.com/apache/impala / TEST_P

Function TEST_P

be/src/util/cache/rl-cache-test.cc:56–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54 ShardingPolicy::SingleShard)));
55
56TEST_P(CacheInvalidationTest, InvalidateAllEntries) {
57 constexpr const int kEntriesNum = 1024;
58 // This scenarios assumes no evictions are done at the cache capacity.
59 ASSERT_LE(kEntriesNum, cache_size());
60
61 // Running invalidation on empty cache should yield no invalidated entries.
62 ASSERT_EQ(0, cache_->Invalidate({}));
63 for (auto i = 0; i < kEntriesNum; ++i) {
64 Insert(i, i);
65 }
66 // Remove a few entries from the cache (sparse pattern of keys).
67 constexpr const int kSparseKeys[] = {1, 100, 101, 500, 501, 512, 999, 1001};
68 for (const auto key : kSparseKeys) {
69 Erase(key);
70 }
71 ASSERT_EQ(ARRAYSIZE(kSparseKeys), evicted_keys_.size());
72
73 // All inserted entries, except for the removed one, should be invalidated.
74 ASSERT_EQ(kEntriesNum - ARRAYSIZE(kSparseKeys), cache_->Invalidate({}));
75 // In the end, no entries should be left in the cache.
76 ASSERT_EQ(kEntriesNum, evicted_keys_.size());
77}
78
79TEST_P(CacheInvalidationTest, InvalidateNoEntries) {
80 constexpr const int kEntriesNum = 10;

Callers

nothing calls this directly

Calls 5

InsertClass · 0.85
DecodeIntFunction · 0.70
InvalidateMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected