Skip to content

Commit 38d1caf

Browse files
Ensure Test Cluster in Azure Discovery Tests Closes (#43057)
* 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
1 parent 58da54e commit 38d1caf

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

plugins/discovery-azure-classic/src/test/java/org/elasticsearch/discovery/azure/classic/AzureDiscoveryClusterFormationTests.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import com.sun.net.httpserver.HttpsConfigurator;
2626
import com.sun.net.httpserver.HttpsServer;
2727
import org.apache.logging.log4j.LogManager;
28-
import org.apache.lucene.util.LuceneTestCase;
2928
import org.elasticsearch.bootstrap.JavaVersion;
3029
import org.elasticsearch.cloud.azure.classic.management.AzureComputeService;
3130
import org.elasticsearch.common.SuppressForbidden;
@@ -71,7 +70,6 @@
7170
import java.util.UUID;
7271
import java.util.concurrent.ExecutionException;
7372

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

293291
@AfterClass
294292
public static void stopHttpd() throws IOException {
295-
for (int i = 0; i < internalCluster().size(); i++) {
293+
try {
296294
// shut them all down otherwise we get spammed with connection refused exceptions
297-
internalCluster().stopRandomDataNode();
295+
internalCluster().close();
296+
} finally {
297+
httpsServer.stop(0);
298+
httpsServer = null;
299+
logDir = null;
298300
}
299-
httpsServer.stop(0);
300-
httpsServer = null;
301-
logDir = null;
302301
}
303302

304303
public void testJoin() throws ExecutionException, InterruptedException {

0 commit comments

Comments
 (0)