Skip to content

Commit 667bdcd

Browse files
Ensure Test Cluster in Azure Discovery Tests Closes (#43057) (#43372)
* 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 b5c8b32 commit 667bdcd

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

+6-7
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
@@ -294,13 +292,14 @@ private static String getProtocol() {
294292

295293
@AfterClass
296294
public static void stopHttpd() throws IOException {
297-
for (int i = 0; i < internalCluster().size(); i++) {
295+
try {
298296
// shut them all down otherwise we get spammed with connection refused exceptions
299-
internalCluster().stopRandomDataNode();
297+
internalCluster().close();
298+
} finally {
299+
httpsServer.stop(0);
300+
httpsServer = null;
301+
logDir = null;
300302
}
301-
httpsServer.stop(0);
302-
httpsServer = null;
303-
logDir = null;
304303
}
305304

306305
public void testJoin() throws ExecutionException, InterruptedException {

0 commit comments

Comments
 (0)