Skip to content

Apache Lucene open-source search software

LUCENE-6666: (damn, how evil!) Thread pool's threads may escape in TestCodecLoadingDeadlock

Dawid Weiss605f8df4d17e
diff --git a/lucene/core/src/test/org/apache/lucene/codecs/TestCodecLoadingDeadlock.java b/lucene/core/src/test/org/apache/lucene/codecs/TestCodecLoadingDeadlock.java
index 03251db24d4..db15a7b690d 100644
--- a/lucene/core/src/test/org/apache/lucene/codecs/TestCodecLoadingDeadlock.java
+++ b/lucene/core/src/test/org/apache/lucene/codecs/TestCodecLoadingDeadlock.java
@@ -30,18 +30,22 @@ import java.util.stream.IntStream;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.NamedThreadFactory;
-import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import com.carrotsearch.randomizedtesting.RandomizedContext;
import com.carrotsearch.randomizedtesting.RandomizedRunner;
+import com.carrotsearch.randomizedtesting.annotations.ThreadLeakLingering;
+
+import static org.junit.Assert.fail;
+import static org.junit.Assert.assertEquals;
/* WARNING: This test does *not* extend LuceneTestCase to prevent static class
* initialization when spawned as subprocess (and please let default codecs alive)! */
@RunWith(RandomizedRunner.class)
-public class TestCodecLoadingDeadlock extends Assert {
+@ThreadLeakLingering(linger = 5000) // Linger a bit waiting for threadpool threads to die.
+public class TestCodecLoadingDeadlock {
@Test
public void testDeadlock() throws Exception {