diff --git a/src/test/java/org/elasticsearch/indices/leaks/IndicesLeaksTests.java b/src/test/java/org/elasticsearch/indices/leaks/IndicesLeaksTests.java index d8468b4b922..d7c53278276 100644 --- a/src/test/java/org/elasticsearch/indices/leaks/IndicesLeaksTests.java +++ b/src/test/java/org/elasticsearch/indices/leaks/IndicesLeaksTests.java @@ -54,7 +54,7 @@ public class IndicesLeaksTests extends ElasticsearchIntegrationTest { client().admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet(); - IndicesService indicesService = internalCluster().getInstance(IndicesService.class); + IndicesService indicesService = internalCluster().getDataNodeInstance(IndicesService.class); IndexService indexService = indicesService.indexServiceSafe("test"); Injector indexInjector = indexService.injector(); IndexShard shard = indexService.shardSafe(0); @@ -90,7 +90,7 @@ public class IndicesLeaksTests extends ElasticsearchIntegrationTest { shard = null; shardInjector = null; - client().admin().indices().prepareDelete().execute().actionGet(); + cluster().wipeIndices("test"); for (int i = 0; i < 100; i++) { System.gc(); @@ -112,7 +112,7 @@ public class IndicesLeaksTests extends ElasticsearchIntegrationTest { } } - //Thread.sleep(1000000); + //System.out.println("sleeping");Thread.sleep(1000000); for (WeakReference indexReference : indexReferences) { assertThat("dangling index reference: " + indexReference.get(), indexReference.get(), nullValue()); diff --git a/src/test/java/org/elasticsearch/test/store/MockDirectoryHelper.java b/src/test/java/org/elasticsearch/test/store/MockDirectoryHelper.java index a2b32322507..8f2f86f45ca 100644 --- a/src/test/java/org/elasticsearch/test/store/MockDirectoryHelper.java +++ b/src/test/java/org/elasticsearch/test/store/MockDirectoryHelper.java @@ -141,6 +141,7 @@ public class MockDirectoryHelper { synchronized (lock) { lock.notifyAll(); } + wrappers.remove(this); } }