Skip to content

Commit

Permalink
Added check for new entries field in IT test, added permissions allow…
Browse files Browse the repository at this point in the history
…ing the domain to run
  • Loading branch information
Peter Alfonsi committed Oct 18, 2023
1 parent 0b2e506 commit 4680ea7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@ public void testCacheWithInvalidation() throws Exception {
assertSearchResponse(resp);
// Should expect hit as here as refresh didn't happen
assertCacheState(client, "index", 1, 1);
assertNumCacheEntries(client, "index", 1);

// Explicit refresh would invalidate cache
refresh();
Expand All @@ -671,6 +672,8 @@ public void testCacheWithInvalidation() throws Exception {
assertSearchResponse(resp);
// Should expect miss as key has changed due to change in IndexReader.CacheKey (due to refresh)
assertCacheState(client, "index", 1, 2);
assertNumCacheEntries(client, "index", 1); // Shouldn't it just be the most recent query, since the first one was invalidated? (prob invalidation isnt in yet)
// yeah - evictions = 0, its not in yet
}

private static void assertCacheState(Client client, String index, long expectedHits, long expectedMisses) {
Expand All @@ -690,4 +693,15 @@ private static void assertCacheState(Client client, String index, long expectedH

}

private static void assertNumCacheEntries(Client client, String index, long expectedEntries) {
RequestCacheStats requestCacheStats = client.admin()
.indices()
.prepareStats(index)
.setRequestCache(true)
.get()
.getTotal()
.getRequestCache();
assertEquals(expectedEntries, requestCacheStats.getEntries());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ public EhcacheDiskCachingTier(
}

public void getManager() {
// based on https://stackoverflow.com/questions/53756412/ehcache-org-ehcache-statetransitionexception-persistence-directory-already-lo
// resolving double-initialization issue when using OpenSearchSingleNodeTestCase
PersistentCacheManager oldCacheManager = cacheManagers.get(nodeId);
if (oldCacheManager != null) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ grant {
permission java.lang.RuntimePermission "createClassLoader";
permission java.lang.RuntimePermission "accessClassInPackage.sun.misc";
permission java.lang.RuntimePermission "getenv.*";
permission java.lang.RuntimePermission "accessDeclaredMembers";
permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
permission java.io.FilePermission "disk_cache_tier", "read"; // change this to wherever we will put disk tier folder
permission java.io.FilePermission "disk_cache_tier", "write";
permission java.io.FilePermission "disk_cache_tier", "delete";
Expand Down

0 comments on commit 4680ea7

Please sign in to comment.