Skip to content

Commit

Permalink
Ensure Test Cluster in Azure Discovery Tests Closes (#43057) (#43372)
Browse files Browse the repository at this point in the history
* Use `internalCluster().close()` to force all nodes (and not just the datanodes) to shut down even if one fails to shut down in time
* Force closing httpServer to get cleaner logs if nodes still hang on shut down
* Relates #43048
  • Loading branch information
original-brownbear authored Jun 19, 2019
1 parent b5c8b32 commit 667bdcd
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import com.sun.net.httpserver.HttpsConfigurator;
import com.sun.net.httpserver.HttpsServer;
import org.apache.logging.log4j.LogManager;
import org.apache.lucene.util.LuceneTestCase;
import org.elasticsearch.bootstrap.JavaVersion;
import org.elasticsearch.cloud.azure.classic.management.AzureComputeService;
import org.elasticsearch.common.SuppressForbidden;
Expand Down Expand Up @@ -71,7 +70,6 @@
import java.util.UUID;
import java.util.concurrent.ExecutionException;

@LuceneTestCase.AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/43048")
@ESIntegTestCase.ClusterScope(numDataNodes = 2, numClientNodes = 0)
@SuppressForbidden(reason = "use http server")
// TODO this should be a IT but currently all ITs in this project run against a real cluster
Expand Down Expand Up @@ -294,13 +292,14 @@ private static String getProtocol() {

@AfterClass
public static void stopHttpd() throws IOException {
for (int i = 0; i < internalCluster().size(); i++) {
try {
// shut them all down otherwise we get spammed with connection refused exceptions
internalCluster().stopRandomDataNode();
internalCluster().close();
} finally {
httpsServer.stop(0);
httpsServer = null;
logDir = null;
}
httpsServer.stop(0);
httpsServer = null;
logDir = null;
}

public void testJoin() throws ExecutionException, InterruptedException {
Expand Down

0 comments on commit 667bdcd

Please sign in to comment.