From eaeba38c91fc4392495241d0f312ff3ba1167661 Mon Sep 17 00:00:00 2001 From: Kiran Prakash Date: Mon, 8 Apr 2024 23:05:58 -0700 Subject: [PATCH] Update IndicesRequestCacheTests.java Signed-off-by: Kiran Prakash --- .../java/org/opensearch/indices/IndicesRequestCacheTests.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/src/test/java/org/opensearch/indices/IndicesRequestCacheTests.java b/server/src/test/java/org/opensearch/indices/IndicesRequestCacheTests.java index df0e028f0245a..2ab38faba6d9e 100644 --- a/server/src/test/java/org/opensearch/indices/IndicesRequestCacheTests.java +++ b/server/src/test/java/org/opensearch/indices/IndicesRequestCacheTests.java @@ -45,6 +45,7 @@ import org.apache.lucene.store.Directory; import org.apache.lucene.util.BytesRef; import org.opensearch.common.CheckedSupplier; +import org.opensearch.common.SuppressForbidden; import org.opensearch.common.cache.RemovalNotification; import org.opensearch.common.cache.RemovalReason; import org.opensearch.common.cache.module.CacheModule; @@ -657,6 +658,7 @@ public void testCleanupKeyToCountMapAreSetAppropriately() throws Exception { // when registering a closed listener raises an exception, we should @Test(expected = Exception.class) + @SuppressForbidden(reason = "only way to avoid registering a reader after caching a key") public void testAddReaderCloseListenerRaisingException_shouldTrackStaleCountAppropriately() throws Exception { IndexReader.CacheHelper cacheHelper = mock(IndexReader.CacheHelper.class); doThrow(new Exception("Mock exception")).when(cacheHelper).addClosedListener(any()); @@ -681,6 +683,7 @@ public void testAddReaderCloseListenerRaisingException_shouldTrackStaleCountAppr } @Test(expected = Exception.class) + @SuppressForbidden(reason = "only way to avoid registering a reader after caching a key") public void testAddReaderCloseListenerRaisingException_shouldCleanupCacheCorrectly() throws Exception { IndexReader.CacheHelper cacheHelper = mock(IndexReader.CacheHelper.class); doThrow(new Exception("Mock exception")).when(cacheHelper).addClosedListener(any());