diff --git a/plugin/trino-druid/src/test/java/io/trino/plugin/druid/TestingDruidServer.java b/plugin/trino-druid/src/test/java/io/trino/plugin/druid/TestingDruidServer.java index bf1acb411296..8266aa77832d 100644 --- a/plugin/trino-druid/src/test/java/io/trino/plugin/druid/TestingDruidServer.java +++ b/plugin/trino-druid/src/test/java/io/trino/plugin/druid/TestingDruidServer.java @@ -58,6 +58,7 @@ public class TestingDruidServer private final GenericContainer middleManager; private final GenericContainer zookeeper; private final OkHttpClient httpClient; + private final Network network; private static final int DRUID_COORDINATOR_PORT = 8081; private static final int DRUID_BROKER_PORT = 8082; @@ -85,7 +86,7 @@ public TestingDruidServer(String dockerImageName) f.setReadable(true, false); f.setExecutable(true, false); this.httpClient = new OkHttpClient(); - Network network = Network.newNetwork(); + network = Network.newNetwork(); this.zookeeper = new GenericContainer<>("zookeeper") .withNetwork(network) .withNetworkAliases("zookeeper") @@ -193,6 +194,7 @@ public void close() closer.register(middleManager::stop); closer.register(coordinator::stop); closer.register(zookeeper::stop); + closer.register(network::close); } catch (FileSystemException e) { // Unfortunately, on CI environment, the user running file deletion runs into diff --git a/plugin/trino-elasticsearch/src/test/java/io/trino/plugin/elasticsearch/TestElasticsearchBackpressure.java b/plugin/trino-elasticsearch/src/test/java/io/trino/plugin/elasticsearch/TestElasticsearchBackpressure.java index 8a9f17f22d56..7cd0ff4bc86f 100644 --- a/plugin/trino-elasticsearch/src/test/java/io/trino/plugin/elasticsearch/TestElasticsearchBackpressure.java +++ b/plugin/trino-elasticsearch/src/test/java/io/trino/plugin/elasticsearch/TestElasticsearchBackpressure.java @@ -31,6 +31,7 @@ public class TestElasticsearchBackpressure { private static final String image = "elasticsearch:7.0.0"; + private Network network; private ElasticsearchServer elasticsearch; private ElasticsearchNginxProxy elasticsearchNginxProxy; @@ -38,7 +39,7 @@ public class TestElasticsearchBackpressure protected QueryRunner createQueryRunner() throws Exception { - Network network = Network.newNetwork(); + network = Network.newNetwork(); elasticsearch = new ElasticsearchServer(network, image, ImmutableMap.of()); elasticsearchNginxProxy = new ElasticsearchNginxProxy(network, 1); @@ -58,6 +59,7 @@ public final void destroy() { elasticsearchNginxProxy.stop(); elasticsearch.stop(); + network.close(); } @Test