Skip to content

Commit

Permalink
Update IndicesRequestCacheIT.java
Browse files Browse the repository at this point in the history
Signed-off-by: Kiran Prakash <awskiran@amazon.com>
  • Loading branch information
kiranprakash154 committed Apr 29, 2024
1 parent d81d42a commit 5b6926e
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1225,15 +1225,16 @@ public void testStaleKeysCleanupWithMultipleIndices() throws Exception {

// force refresh both index1 and index2
flushAndRefresh(index1, index2);
// create another cache entry in index 1, this should not be cleaned up.
// create another cache entry in index 1 same as memorySizeForIndex1With1Entries, this should not be cleaned up.
createCacheEntry(client, index1, "hello");
// sleep until cache cleaner would have cleaned up the stale key from index2
assertBusy(() -> {
// cache cleaner should have cleaned up the stale key from index2 and hence cache should be empty
assertEquals(0, getRequestCacheStats(client, index2).getMemorySizeInBytes());
// cache cleaner should have only cleaned up the stale entities for index1
long currentMemorySizeInBytesForIndex1 = getRequestCacheStats(client, index1).getMemorySizeInBytes();
assertTrue(currentMemorySizeInBytesForIndex1 < memorySizeForIndex1With2Entries);
// assert the memory size of index1 to only contain 1 entry added after flushAndRefresh
assertEquals(memorySizeForIndex1With1Entries, currentMemorySizeInBytesForIndex1);
// cache for index1 should not be empty since there was an item cached after flushAndRefresh
assertTrue(currentMemorySizeInBytesForIndex1 > 0);
}, cacheCleanIntervalInMillis * 2, TimeUnit.MILLISECONDS);
Expand Down

0 comments on commit 5b6926e

Please sign in to comment.