|
13 | 13 | import org.apache.lucene.store.IndexInput; |
14 | 14 | import org.apache.lucene.store.MMapDirectory; |
15 | 15 | import org.apache.lucene.store.SimpleFSLockFactory; |
16 | | -import org.opensearch.common.breaker.TestCircuitBreaker; |
17 | | -import org.opensearch.core.common.breaker.CircuitBreakingException; |
| 16 | +import org.opensearch.core.common.breaker.CircuitBreaker; |
| 17 | +import org.opensearch.core.common.breaker.NoopCircuitBreaker; |
18 | 18 | import org.opensearch.index.store.remote.file.CleanerDaemonThreadLeakFilter; |
19 | 19 | import org.opensearch.index.store.remote.filecache.FileCache; |
20 | 20 | import org.opensearch.index.store.remote.filecache.FileCacheFactory; |
|
38 | 38 | @ThreadLeakFilters(filters = CleanerDaemonThreadLeakFilter.class) |
39 | 39 | public abstract class TransferManagerTestCase extends OpenSearchTestCase { |
40 | 40 | protected static final int EIGHT_MB = 1024 * 1024 * 8; |
41 | | - protected final TestCircuitBreaker testCircuitBreaker = new TestCircuitBreaker(); |
42 | | - protected final FileCache fileCache = FileCacheFactory.createConcurrentLRUFileCache(EIGHT_MB * 2, 1, testCircuitBreaker); |
| 41 | + protected final FileCache fileCache = FileCacheFactory.createConcurrentLRUFileCache( |
| 42 | + EIGHT_MB * 2, |
| 43 | + 1, |
| 44 | + new NoopCircuitBreaker(CircuitBreaker.REQUEST) |
| 45 | + ); |
43 | 46 | protected MMapDirectory directory; |
44 | 47 | protected TransferManager transferManager; |
45 | 48 |
|
@@ -153,29 +156,6 @@ public void testDownloadFails() throws Exception { |
153 | 156 | MatcherAssert.assertThat(fileCache.usage(), equalTo(0L)); |
154 | 157 | } |
155 | 158 |
|
156 | | - public void testCircuitBreakerWhileDownloading() throws IOException { |
157 | | - // fetch blob when circuit breaking is not tripping |
158 | | - try (IndexInput i = fetchBlobWithName("1")) { |
159 | | - assertIndexInputIsFunctional(i); |
160 | | - MatcherAssert.assertThat(fileCache.activeUsage(), equalTo((long) EIGHT_MB)); |
161 | | - } |
162 | | - // should have entry in file cache |
163 | | - MatcherAssert.assertThat(fileCache.activeUsage(), equalTo(0L)); |
164 | | - MatcherAssert.assertThat(fileCache.usage(), equalTo((long) EIGHT_MB)); |
165 | | - |
166 | | - // start tripping the circuit breaker |
167 | | - testCircuitBreaker.startBreaking(); |
168 | | - |
169 | | - // fetch blob which already had entry in file cache, should not encounter circuit breaking exceptions |
170 | | - try (IndexInput i = fetchBlobWithName("1")) { |
171 | | - assertIndexInputIsFunctional(i); |
172 | | - MatcherAssert.assertThat(fileCache.activeUsage(), equalTo((long) EIGHT_MB)); |
173 | | - } |
174 | | - |
175 | | - // fetch new blob - should encounter circuit breaking exception |
176 | | - expectThrows(CircuitBreakingException.class, () -> fetchBlobWithName("2")); |
177 | | - } |
178 | | - |
179 | 159 | public void testFetchesToDifferentBlobsDoNotBlockOnEachOther() throws Exception { |
180 | 160 | // Mock a call for a blob that will block until the latch is released, |
181 | 161 | // then start the fetch for that blob on a separate thread |
|
0 commit comments