Skip to content

Commit 5c1f299

Browse files
committed
Add some consistency checks to this test
1 parent 873ad84 commit 5c1f299

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authz/accesscontrol/DocumentSubsetBitsetCacheTests.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ public void accept(SearchExecutionContext searchExecutionContext, LeafReaderCont
435435
runTestOnIndex(consumer);
436436
}
437437

438-
public void testCacheClearEntriesWhenIndexIsClosed() throws Exception {
438+
public void testCacheClearsEntriesWhenIndexIsClosed() throws Exception {
439439
final DocumentSubsetBitsetCache cache = newCache(Settings.EMPTY);
440440
assertThat(cache.entryCount(), equalTo(0));
441441
assertThat(cache.ramBytesUsed(), equalTo(0L));
@@ -447,9 +447,13 @@ public void testCacheClearEntriesWhenIndexIsClosed() throws Exception {
447447
final BitSet bitSet = cache.getBitSet(query, leafContext);
448448
assertThat(bitSet, notNullValue());
449449
}
450+
cache.verifyInternalConsistency();
450451
assertThat(cache.entryCount(), not(equalTo(0)));
451452
assertThat(cache.ramBytesUsed(), not(equalTo(0L)));
452453
});
454+
cache.verifyInternalConsistency();
455+
456+
// closing an index results in the associated entries being removed from the cache (at least when single threaded)
453457
assertThat(cache.entryCount(), equalTo(0));
454458
assertThat(cache.ramBytesUsed(), equalTo(0L));
455459
}

0 commit comments

Comments
 (0)