diff --git a/server/src/test/java/org/elasticsearch/client/transport/TransportClientNodesServiceTests.java b/server/src/test/java/org/elasticsearch/client/transport/TransportClientNodesServiceTests.java index 9baf2e1c956..d64cdf89ef7 100644 --- a/server/src/test/java/org/elasticsearch/client/transport/TransportClientNodesServiceTests.java +++ b/server/src/test/java/org/elasticsearch/client/transport/TransportClientNodesServiceTests.java @@ -213,11 +213,7 @@ public class TransportClientNodesServiceTests extends ESTestCase { transport.endConnectMode(); transportService.stop(); transportClientNodesService.close(); - try { - terminate(threadPool); - } catch (InterruptedException e) { - throw new AssertionError(e); - } + terminate(threadPool); } } diff --git a/server/src/test/java/org/elasticsearch/transport/TransportActionProxyTests.java b/server/src/test/java/org/elasticsearch/transport/TransportActionProxyTests.java index bccb1cc68aa..428d416ac02 100644 --- a/server/src/test/java/org/elasticsearch/transport/TransportActionProxyTests.java +++ b/server/src/test/java/org/elasticsearch/transport/TransportActionProxyTests.java @@ -69,11 +69,7 @@ public class TransportActionProxyTests extends ESTestCase { public void tearDown() throws Exception { super.tearDown(); IOUtils.close(serviceA, serviceB, serviceC, () -> { - try { - terminate(threadPool); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } + terminate(threadPool); }); } diff --git a/test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java index 9a21f28eed6..7502f8430d7 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java @@ -50,7 +50,6 @@ import org.elasticsearch.action.admin.indices.segments.ShardSegments; import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequestBuilder; import org.elasticsearch.action.bulk.BulkRequestBuilder; import org.elasticsearch.action.bulk.BulkResponse; -import org.elasticsearch.action.get.GetResponse; import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.index.IndexResponse; import org.elasticsearch.action.search.ClearScrollResponse; @@ -183,7 +182,6 @@ import java.util.Set; import java.util.concurrent.Callable; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CountDownLatch; -import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; @@ -382,8 +380,6 @@ public abstract class ESIntegTestCase extends ESTestCase { case TEST: currentCluster = buildAndPutCluster(currentClusterScope, randomLong()); break; - default: - fail("Unknown Scope: [" + currentClusterScope + "]"); } cluster().beforeTest(random(), getPerTestTransportClientRatio()); cluster().wipe(excludeTemplates()); @@ -402,7 +398,7 @@ public abstract class ESIntegTestCase extends ESTestCase { * Creates a randomized index template. This template is used to pass in randomized settings on a * per index basis. Allows to enable/disable the randomization for number of shards and replicas */ - public void randomIndexTemplate() throws IOException { + public void randomIndexTemplate() { // TODO move settings for random directory etc here into the index based randomized settings. if (cluster().size() > 0) { @@ -798,12 +794,12 @@ public abstract class ESIntegTestCase extends ESTestCase { if (numNodes > 0) { internalCluster().ensureAtLeastNumDataNodes(numNodes); - getExcludeSettings(index, numNodes, builder); + getExcludeSettings(numNodes, builder); } return client().admin().indices().prepareCreate(index).setSettings(builder.build()); } - private Settings.Builder getExcludeSettings(String index, int num, Settings.Builder builder) { + private Settings.Builder getExcludeSettings(int num, Settings.Builder builder) { String exclude = String.join(",", internalCluster().allDataNodesButN(num)); builder.put("index.routing.allocation.exclude._name", exclude); return builder; @@ -896,7 +892,7 @@ public abstract class ESIntegTestCase extends ESTestCase { internalCluster().ensureAtLeastNumDataNodes(n); Settings.Builder builder = Settings.builder(); if (n > 0) { - getExcludeSettings(index, n, builder); + getExcludeSettings(n, builder); } Settings build = builder.build(); if (!build.isEmpty()) { @@ -1296,16 +1292,6 @@ public abstract class ESIntegTestCase extends ESTestCase { return client().prepareIndex(index, type, id).setSource(source).execute().actionGet(); } - /** - * Syntactic sugar for: - *
-     *   client().prepareGet(index, type, id).execute().actionGet();
-     * 
- */ - protected final GetResponse get(String index, String type, String id) { - return client().prepareGet(index, type, id).execute().actionGet(); - } - /** * Syntactic sugar for: *
@@ -1418,12 +1404,12 @@ public abstract class ESIntegTestCase extends ESTestCase {
     /**
      * Convenience method that forwards to {@link #indexRandom(boolean, List)}.
      */
-    public void indexRandom(boolean forceRefresh, IndexRequestBuilder... builders) throws InterruptedException, ExecutionException {
+    public void indexRandom(boolean forceRefresh, IndexRequestBuilder... builders) throws InterruptedException {
         indexRandom(forceRefresh, Arrays.asList(builders));
     }
 
     public void indexRandom(boolean forceRefresh, boolean dummyDocuments, IndexRequestBuilder... builders)
-            throws InterruptedException, ExecutionException {
+            throws InterruptedException {
         indexRandom(forceRefresh, dummyDocuments, Arrays.asList(builders));
     }
 
@@ -1442,7 +1428,7 @@ public abstract class ESIntegTestCase extends ESTestCase {
      * @param builders     the documents to index.
      * @see #indexRandom(boolean, boolean, java.util.List)
      */
-    public void indexRandom(boolean forceRefresh, List builders) throws InterruptedException, ExecutionException {
+    public void indexRandom(boolean forceRefresh, List builders) throws InterruptedException {
         indexRandom(forceRefresh, forceRefresh, builders);
     }
 
@@ -1459,7 +1445,7 @@ public abstract class ESIntegTestCase extends ESTestCase {
      * @param builders       the documents to index.
      */
     public void indexRandom(boolean forceRefresh, boolean dummyDocuments, List builders)
-            throws InterruptedException, ExecutionException {
+            throws InterruptedException {
         indexRandom(forceRefresh, dummyDocuments, true, builders);
     }
 
@@ -1477,7 +1463,7 @@ public abstract class ESIntegTestCase extends ESTestCase {
      * @param builders       the documents to index.
      */
     public void indexRandom(boolean forceRefresh, boolean dummyDocuments, boolean maybeFlush, List builders)
-            throws InterruptedException, ExecutionException {
+            throws InterruptedException {
         Random random = random();
         Map> indicesAndTypes = new HashMap<>();
         for (IndexRequestBuilder builder : builders) {
diff --git a/test/framework/src/main/java/org/elasticsearch/test/ESTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/ESTestCase.java
index d5cf798682a..82d2c2302e6 100644
--- a/test/framework/src/main/java/org/elasticsearch/test/ESTestCase.java
+++ b/test/framework/src/main/java/org/elasticsearch/test/ESTestCase.java
@@ -250,7 +250,6 @@ public abstract class ESTestCase extends LuceneTestCase {
     }
 
     protected final Logger logger = Loggers.getLogger(getClass());
-    protected final DeprecationLogger deprecationLogger = new DeprecationLogger(logger);
     private ThreadContext threadContext;
 
     // -----------------------------------------------------------------
@@ -370,7 +369,7 @@ public abstract class ESTestCase extends LuceneTestCase {
         return "[" + name.substring(start + 1, end) + "] ";
     }
 
-    private void ensureNoWarnings() throws IOException {
+    private void ensureNoWarnings() {
         //Check that there are no unaccounted warning headers. These should be checked with {@link #assertWarnings(String...)} in the
         //appropriate test
         try {
@@ -510,7 +509,7 @@ public abstract class ESTestCase extends LuceneTestCase {
         checkIndexFailed = false;
     }
 
-    public final void ensureCheckIndexPassed() throws Exception {
+    public final void ensureCheckIndexPassed() {
         assertFalse("at least one shard failed CheckIndex", checkIndexFailed);
     }
 
@@ -878,7 +877,7 @@ public abstract class ESTestCase extends LuceneTestCase {
         return breakSupplier.getAsBoolean();
     }
 
-    public static boolean terminate(ExecutorService... services) throws InterruptedException {
+    public static boolean terminate(ExecutorService... services) {
         boolean terminated = true;
         for (ExecutorService service : services) {
             if (service != null) {
@@ -888,7 +887,7 @@ public abstract class ESTestCase extends LuceneTestCase {
         return terminated;
     }
 
-    public static boolean terminate(ThreadPool threadPool) throws InterruptedException {
+    public static boolean terminate(ThreadPool threadPool) {
         return ThreadPool.terminate(threadPool, 10, TimeUnit.SECONDS);
     }
 
@@ -943,23 +942,6 @@ public abstract class ESTestCase extends LuceneTestCase {
         return builder;
     }
 
-    private static String threadName(Thread t) {
-        return "Thread[" +
-                "id=" + t.getId() +
-                ", name=" + t.getName() +
-                ", state=" + t.getState() +
-                ", group=" + groupName(t.getThreadGroup()) +
-                "]";
-    }
-
-    private static String groupName(ThreadGroup threadGroup) {
-        if (threadGroup == null) {
-            return "{null group}";
-        } else {
-            return threadGroup.getName();
-        }
-    }
-
     /**
      * Returns size random values
      */
diff --git a/test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java b/test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java
index f9efedc2561..ce7e6369412 100644
--- a/test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java
+++ b/test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java
@@ -696,13 +696,6 @@ public final class InternalTestCluster extends TestCluster {
         return suffix;
     }
 
-    /**
-     * Returns the common node name prefix for this test cluster.
-     */
-    public String nodePrefix() {
-        return nodePrefix;
-    }
-
     @Override
     public synchronized Client client() {
         ensureOpen();
@@ -804,21 +797,6 @@ public final class InternalTestCluster extends TestCluster {
         return null; // can't happen
     }
 
-    /**
-     * Returns a random node that applies to the given predicate.
-     * The predicate can filter nodes based on the nodes settings.
-     * If all nodes are filtered out this method will return null
-     */
-    public synchronized Client client(final Predicate filterPredicate) {
-        ensureOpen();
-        final NodeAndClient randomNodeAndClient =
-                getRandomNodeAndClient(nodeAndClient -> filterPredicate.test(nodeAndClient.node.settings()));
-        if (randomNodeAndClient != null) {
-            return randomNodeAndClient.client(random);
-        }
-        return null;
-    }
-
     @Override
     public synchronized void close() {
         if (this.open.compareAndSet(true, false)) {
@@ -914,7 +892,7 @@ public final class InternalTestCluster extends TestCluster {
             return clientWrapper.apply(transportClient);
         }
 
-        void resetClient() throws IOException {
+        void resetClient() {
             if (closed.get() == false) {
                 Releasables.close(nodeClient, transportClient);
                 nodeClient = null;
@@ -1388,7 +1366,7 @@ public final class InternalTestCluster extends TestCluster {
         });
     }
 
-    private void randomlyResetClients() throws IOException {
+    private void randomlyResetClients() {
         // only reset the clients on nightly tests, it causes heavy load...
         if (RandomizedTest.isNightly() && rarely(random)) {
             final Collection nodesAndClients = nodes.values();
@@ -1654,20 +1632,6 @@ public final class InternalTestCluster extends TestCluster {
         }
     }
 
-    /**
-     * Restarts a random node in the cluster
-     */
-    public void restartRandomNode() throws Exception {
-        restartRandomNode(EMPTY_CALLBACK);
-    }
-
-    /**
-     * Restarts a random node in the cluster and calls the callback during restart.
-     */
-    public void restartRandomNode(RestartCallback callback) throws Exception {
-        restartRandomNode(nc -> true, callback);
-    }
-
     /**
      * Restarts a random data node in the cluster
      */
@@ -1718,13 +1682,6 @@ public final class InternalTestCluster extends TestCluster {
         fullRestart(EMPTY_CALLBACK);
     }
 
-    /**
-     * Restarts all nodes in a rolling restart fashion ie. only restarts on node a time.
-     */
-    public void rollingRestart() throws Exception {
-        rollingRestart(EMPTY_CALLBACK);
-    }
-
     /**
      * Restarts all nodes in a rolling restart fashion ie. only restarts on node a time.
      */
diff --git a/test/framework/src/main/java/org/elasticsearch/transport/AbstractSimpleTransportTestCase.java b/test/framework/src/main/java/org/elasticsearch/transport/AbstractSimpleTransportTestCase.java
index b10ad2d0eb3..3b64f00084e 100644
--- a/test/framework/src/main/java/org/elasticsearch/transport/AbstractSimpleTransportTestCase.java
+++ b/test/framework/src/main/java/org/elasticsearch/transport/AbstractSimpleTransportTestCase.java
@@ -186,11 +186,7 @@ public abstract class AbstractSimpleTransportTestCase extends ESTestCase {
             assertNoPendingHandshakes(serviceB.getOriginalTransport());
         } finally {
             IOUtils.close(serviceA, serviceB, () -> {
-                try {
-                    terminate(threadPool);
-                } catch (InterruptedException e) {
-                    Thread.currentThread().interrupt();
-                }
+                terminate(threadPool);
             });
         }
     }
diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/test/http/MockWebServer.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/test/http/MockWebServer.java
index 516d695db85..10ea0111b91 100644
--- a/x-pack/plugin/core/src/test/java/org/elasticsearch/test/http/MockWebServer.java
+++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/test/http/MockWebServer.java
@@ -247,10 +247,7 @@ public class MockWebServer implements Closeable {
         latches.forEach(CountDownLatch::countDown);
 
         if (server.getExecutor() instanceof ExecutorService) {
-            try {
-                terminate((ExecutorService) server.getExecutor());
-            } catch (InterruptedException e) {
-            }
+            terminate((ExecutorService) server.getExecutor());
         }
         server.stop(0);
     }
diff --git a/x-pack/qa/saml-idp-tests/src/test/java/org/elasticsearch/xpack/security/authc/saml/SamlAuthenticationIT.java b/x-pack/qa/saml-idp-tests/src/test/java/org/elasticsearch/xpack/security/authc/saml/SamlAuthenticationIT.java
index b3fc7dd0c2f..a4dcfdeb993 100644
--- a/x-pack/qa/saml-idp-tests/src/test/java/org/elasticsearch/xpack/security/authc/saml/SamlAuthenticationIT.java
+++ b/x-pack/qa/saml-idp-tests/src/test/java/org/elasticsearch/xpack/security/authc/saml/SamlAuthenticationIT.java
@@ -125,11 +125,7 @@ public class SamlAuthenticationIT extends ESRestTestCase {
     public static void shutdownHttpServer() {
         final Executor executor = httpServer.getExecutor();
         if (executor instanceof ExecutorService) {
-            try {
-                terminate((ExecutorService) executor);
-            } catch (InterruptedException e) {
-                // oh well
-            }
+            terminate((ExecutorService) executor);
         }
         httpServer.stop(0);
         httpServer = null;