From eef10938bab9799fcafbba9c469d52e19c683fca Mon Sep 17 00:00:00 2001 From: Henning Andersen Date: Tue, 27 Aug 2024 15:04:28 +0200 Subject: [PATCH] Minimal testing --- .../blobcache/shared/SharedBlobCacheService.java | 5 +++++ .../blobcache/shared/SharedBlobCacheServiceTests.java | 1 + 2 files changed, 6 insertions(+) diff --git a/x-pack/plugin/blob-cache/src/main/java/org/elasticsearch/blobcache/shared/SharedBlobCacheService.java b/x-pack/plugin/blob-cache/src/main/java/org/elasticsearch/blobcache/shared/SharedBlobCacheService.java index db5d17d20f914..b1e5bb7cec722 100644 --- a/x-pack/plugin/blob-cache/src/main/java/org/elasticsearch/blobcache/shared/SharedBlobCacheService.java +++ b/x-pack/plugin/blob-cache/src/main/java/org/elasticsearch/blobcache/shared/SharedBlobCacheService.java @@ -912,6 +912,11 @@ private SharedBytes.IO nonVolatileIO() { return io; } + // for use in tests *only* + SharedBytes.IO testOnlyNonVolatileIO() { + return io; + } + /** * Optimistically try to read from the region * @return true if successful, i.e., not evicted and data available, false if evicted diff --git a/x-pack/plugin/blob-cache/src/test/java/org/elasticsearch/blobcache/shared/SharedBlobCacheServiceTests.java b/x-pack/plugin/blob-cache/src/test/java/org/elasticsearch/blobcache/shared/SharedBlobCacheServiceTests.java index 917b28d2ea566..8542de759c8a4 100644 --- a/x-pack/plugin/blob-cache/src/test/java/org/elasticsearch/blobcache/shared/SharedBlobCacheServiceTests.java +++ b/x-pack/plugin/blob-cache/src/test/java/org/elasticsearch/blobcache/shared/SharedBlobCacheServiceTests.java @@ -497,6 +497,7 @@ public void testGetMultiThreaded() throws IOException { if (yield[i] == 0) { Thread.yield(); } + assertNotNull(cacheFileRegion.testOnlyNonVolatileIO()); cacheFileRegion.decRef(); } if (evict[i] == 0) {