Skip to content

Commit e4f5760

Browse files
committed
It should always be consistent when single threaded
1 parent 2fe947e commit e4f5760

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
@@ -284,19 +284,23 @@ public void testIndexLookupIsClearedWhenBitSetIsEvicted() throws Exception {
284284
assertThat(cache.ramBytesUsed(), equalTo(0L));
285285

286286
runTestOnIndex((searchExecutionContext, leafContext) -> {
287+
cache.verifyInternalConsistency();
288+
287289
final Query query1 = QueryBuilders.termQuery("field-1", "value-1").toQuery(searchExecutionContext);
288290
final BitSet bitSet1 = cache.getBitSet(query1, leafContext);
289291
assertThat(bitSet1, notNullValue());
292+
cache.verifyInternalConsistency();
290293

291294
final Query query2 = QueryBuilders.termQuery("field-2", "value-2").toQuery(searchExecutionContext);
292295
final BitSet bitSet2 = cache.getBitSet(query2, leafContext);
293296
assertThat(bitSet2, notNullValue());
294297
cache.verifyInternalConsistency();
295298

296-
// Check that the original bitset is no longer in the cache (a new instance is returned)
297299
assertThat(cache.getBitSet(query1, leafContext), not(sameInstance(bitSet1)));
298300
cache.verifyInternalConsistency();
299301
});
302+
303+
cache.verifyInternalConsistency();
300304
}
301305

302306
public void testCacheUnderConcurrentAccess() throws Exception {

0 commit comments

Comments
 (0)