Skip to content

Commit

Permalink
spotless apply
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 23, 2024
1 parent d5cdf50 commit 9068227
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@
import java.util.concurrent.atomic.AtomicInteger;

import static org.opensearch.indices.IndicesRequestCache.INDICES_REQUEST_CACHE_STALENESS_THRESHOLD_SETTING;
import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertAcked;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertAcked;

public class IndicesRequestCacheTests extends OpenSearchSingleNodeTestCase {
private ThreadPool threadPool;
Expand Down Expand Up @@ -538,7 +538,8 @@ public void testStaleCount_WithoutReaderClosing_DecrementsStaleCount() throws Ex
new ICacheKey<>(key),
getTermBytes(),
RemovalReason.EVICTED
));
)
);
// stale keys count should stay zero
assertEquals(0, cache.cacheCleanupManager.getStaleKeysCount().get());

Expand Down Expand Up @@ -587,19 +588,17 @@ public void testStaleCount_OnRemovalNotifications() throws Exception {
new ICacheKey<>(key),
getTermBytes(),
RemovalReason.REPLACED
));
)
);
// stale keys count should stay the same
assertEquals(staleCount, cache.cacheCleanupManager.getStaleKeysCount().get());

// Notification for all but Replaced should deduct the staleCount
RemovalReason[] reasons = { RemovalReason.INVALIDATED, RemovalReason.EVICTED, RemovalReason.EXPLICIT, RemovalReason.CAPACITY };
for (RemovalReason reason : reasons) {
cache.onRemoval(
new RemovalNotification<ICacheKey<IndicesRequestCache.Key>, BytesReference>(
new ICacheKey<>(key),
getTermBytes(),
reason
));
new RemovalNotification<ICacheKey<IndicesRequestCache.Key>, BytesReference>(new ICacheKey<>(key), getTermBytes(), reason)
);
assertEquals(--staleCount, cache.cacheCleanupManager.getStaleKeysCount().get());
}
}
Expand Down

0 comments on commit 9068227

Please sign in to comment.