Tests: Remove thread leak filter

Now that the global cluster is gone, we shoudln't need to ignore
thread leaks across tests.  We unfortunately still need suite level
scope, since most tests are using suite scope clusters (although
test clope clusters should really switch back to test scope thread
leaks).

closes #9843
This commit is contained in:
Ryan Ernst 2015-02-24 08:06:10 -08:00
parent 3e1c7b5a0c
commit 4ee7ed987e
10 changed files with 25 additions and 46 deletions

View File

@ -145,6 +145,7 @@ public class RecoverySettings extends AbstractComponent implements Closeable {
@Override
public void close() {
ThreadPool.terminate(concurrentStreamPool, 1, TimeUnit.SECONDS);
ThreadPool.terminate(concurrentSmallFileStreamPool, 1, TimeUnit.SECONDS);
}
public ByteSizeValue fileChunkSize() {

View File

@ -20,27 +20,18 @@
package org.elasticsearch.index.codec.postingformat;
import com.carrotsearch.randomizedtesting.annotations.Listeners;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope;
import com.carrotsearch.randomizedtesting.annotations.TimeoutSuite;
import org.apache.lucene.codecs.Codec;
import org.apache.lucene.codecs.PostingsFormat;
import org.apache.lucene.index.BasePostingsFormatTestCase;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.TestUtil;
import org.apache.lucene.util.TimeUnits;
import org.elasticsearch.common.util.BloomFilter;
import org.elasticsearch.index.codec.postingsformat.BloomFilterPostingsFormat;
import org.elasticsearch.index.codec.postingsformat.Elasticsearch090PostingsFormat;
import org.elasticsearch.test.ElasticsearchThreadFilter;
import org.elasticsearch.test.junit.listeners.ReproduceInfoPrinter;
/** Runs elasticsearch postings format against lucene's standard postings format tests */
@Listeners({
ReproduceInfoPrinter.class
})
@ThreadLeakFilters(defaultFilters = true, filters = {ElasticsearchThreadFilter.class})
@ThreadLeakScope(ThreadLeakScope.Scope.NONE)
@TimeoutSuite(millis = TimeUnits.HOUR)
@LuceneTestCase.SuppressSysoutChecks(bugUrl = "we log a lot on purpose")
public class ElasticsearchPostingsFormatTest extends BasePostingsFormatTestCase {

View File

@ -18,20 +18,26 @@
*/
package org.elasticsearch.index.store;
import com.carrotsearch.randomizedtesting.annotations.*;
import com.carrotsearch.randomizedtesting.annotations.Listeners;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakLingering;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope;
import com.carrotsearch.randomizedtesting.annotations.TimeoutSuite;
import com.carrotsearch.randomizedtesting.generators.RandomInts;
import com.carrotsearch.randomizedtesting.generators.RandomPicks;
import com.google.common.collect.ImmutableSet;
import org.apache.lucene.index.IndexFileNames;
import org.apache.lucene.store.*;
import org.apache.lucene.store.BaseDirectoryTestCase;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FilterDirectory;
import org.apache.lucene.store.IOContext;
import org.apache.lucene.store.IndexOutput;
import org.apache.lucene.store.MockDirectoryWrapper;
import org.apache.lucene.util.IOUtils;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.TimeUnits;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.index.store.distributor.Distributor;
import org.elasticsearch.test.ElasticsearchThreadFilter;
import org.elasticsearch.test.junit.listeners.LoggingListener;
import java.io.FileNotFoundException;
@ -43,7 +49,6 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
@ThreadLeakFilters(defaultFilters = true, filters = {ElasticsearchThreadFilter.class})
@ThreadLeakScope(ThreadLeakScope.Scope.SUITE)
@ThreadLeakLingering(linger = 5000) // 5 sec lingering
@TimeoutSuite(millis = 5 * TimeUnits.MINUTE)

View File

@ -19,7 +19,6 @@
package org.elasticsearch.index.store;
import com.carrotsearch.randomizedtesting.annotations.Listeners;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakLingering;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope;
import org.apache.lucene.index.DirectoryReader;
@ -32,7 +31,6 @@ import org.apache.lucene.util.LuceneTestCase;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.index.store.distributor.Distributor;
import org.elasticsearch.test.ElasticsearchThreadFilter;
import org.elasticsearch.test.junit.listeners.LoggingListener;
import org.junit.Before;
@ -47,7 +45,6 @@ import java.util.concurrent.ExecutorService;
* hard concurrent pressure on the directory etc. to ensure DistributorDirectory is behaving ok.
*/
@LuceneTestCase.SuppressCodecs({ "SimpleText", "Memory", "Direct" })
@ThreadLeakFilters(defaultFilters = true, filters = {ElasticsearchThreadFilter.class})
@ThreadLeakScope(ThreadLeakScope.Scope.SUITE)
@ThreadLeakLingering(linger = 5000) // 5 sec lingering
@Listeners(LoggingListener.class)

View File

@ -19,6 +19,7 @@
package org.elasticsearch.indices.analyze;
import org.apache.lucene.analysis.hunspell.Dictionary;
import org.apache.lucene.util.LuceneTestCase;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.ExceptionsHelper;
import org.elasticsearch.common.settings.ImmutableSettings;
@ -90,6 +91,7 @@ public class HunspellServiceTests extends ElasticsearchIntegrationTest {
}
@Test
@LuceneTestCase.AwaitsFix(bugUrl = "https://github.com/elasticsearch/elasticsearch/issues/9849")
public void testDicWithNoAff() throws Exception {
Settings settings = ImmutableSettings.settingsBuilder()
.put("path.conf", getResourcePath("/indices/analyze/no_aff_conf_dir"))
@ -109,6 +111,7 @@ public class HunspellServiceTests extends ElasticsearchIntegrationTest {
}
@Test
@LuceneTestCase.AwaitsFix(bugUrl = "https://github.com/elasticsearch/elasticsearch/issues/9849")
public void testDicWithTwoAffs() throws Exception {
Settings settings = ImmutableSettings.settingsBuilder()
.put("path.conf", getResourcePath("/indices/analyze/two_aff_conf_dir"))

View File

@ -118,6 +118,7 @@ import org.junit.*;
import java.io.IOException;
import java.io.InputStream;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@ -579,7 +580,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
}
}
protected final void afterInternal() throws Exception {
protected final void afterInternal(boolean afterClass) throws Exception {
boolean success = false;
try {
logger.info("[{}#{}]: cleaning up after test", getTestClass().getSimpleName(), getTestName());
@ -596,6 +597,9 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
}
ensureClusterSizeConsistency();
cluster().wipe(); // wipe after to make sure we fail in the test that didn't ack the delete
if (afterClass || currentClusterScope == Scope.TEST) {
cluster().close();
}
cluster().assertAfterTest();
}
} finally {
@ -1799,7 +1803,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
@After
public final void after() throws Exception {
if (runTestScopeLifecycle()) {
afterInternal();
afterInternal(false);
}
}
@ -1807,7 +1811,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
public static void afterClass() throws Exception {
if (!runTestScopeLifecycle()) {
try {
INSTANCE.afterInternal();
INSTANCE.afterInternal(true);
} finally {
INSTANCE = null;
}
@ -1893,25 +1897,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
}
private static boolean isSuiteScopedTest(Class<?> clazz) {
if (clazz == Object.class || clazz == ElasticsearchIntegrationTest.class) {
return false;
}
SuiteScopeTest annotation = clazz.getAnnotation(SuiteScopeTest.class);
if (annotation != null) {
return true;
}
return isSuiteScopedTest(clazz.getSuperclass());
}
private static boolean isSuiteScopeCluster(Class<?> clazz) {
if (clazz == Object.class || clazz == ElasticsearchIntegrationTest.class) {
return false;
}
SuiteScopeTest annotation = clazz.getAnnotation(SuiteScopeTest.class);
if (annotation != null) {
return true;
}
return isSuiteScopedTest(clazz.getSuperclass());
return clazz.getAnnotation(SuiteScopeTest.class) != null;
}
/**
@ -1921,7 +1907,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
* that is executed in a separate test instance. Variables that need to be accessible across test instances must be static.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
@Inherited
@Ignore
public @interface SuiteScopeTest {
}

View File

@ -34,7 +34,6 @@ import org.elasticsearch.test.junit.listeners.ReproduceInfoPrinter;
@Listeners({
ReproduceInfoPrinter.class
})
@ThreadLeakFilters(defaultFilters = true, filters = {ElasticsearchThreadFilter.class})
@ThreadLeakScope(Scope.SUITE)
@ThreadLeakLingering(linger = 5000) // 5 sec lingering
@TimeoutSuite(millis = TimeUnits.HOUR)

View File

@ -58,8 +58,8 @@ public abstract class ElasticsearchSingleNodeTest extends ElasticsearchTestCase
private static void reset() {
assert NODE != null;
node().stop();
NODE = newNode();
stopNode();
startNode();
}
private static void startNode() {

View File

@ -73,7 +73,6 @@ import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAllS
/**
* Base testcase for randomized unit testing with Elasticsearch
*/
@ThreadLeakFilters(defaultFilters = true, filters = {ElasticsearchThreadFilter.class})
@ThreadLeakScope(Scope.SUITE)
@ThreadLeakLingering(linger = 5000) // 5 sec lingering
@TimeoutSuite(millis = 20 * TimeUnits.MINUTE) // timeout the suite after 20min and fail the test.

View File

@ -35,8 +35,6 @@ import org.elasticsearch.test.junit.listeners.ReproduceInfoPrinter;
@Listeners({
ReproduceInfoPrinter.class
})
@ThreadLeakFilters(defaultFilters = true, filters = {ElasticsearchThreadFilter.class})
@ThreadLeakScope(Scope.NONE)
@TimeoutSuite(millis = TimeUnits.HOUR)
@LuceneTestCase.SuppressSysoutChecks(bugUrl = "we log a lot on purpose")
/**