Skip to content

Commit

Permalink
Make ElasticsearchServer Closeable
Browse files Browse the repository at this point in the history
  • Loading branch information
striderarun authored and martint committed Jan 17, 2025
1 parent 69bae9a commit 2a36038
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected QueryRunner createQueryRunner()
public final void destroy()
throws IOException
{
server.stop();
server.close();
server = null;
client.close();
client = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

import javax.net.ssl.SSLContext;

import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
Expand All @@ -51,6 +52,7 @@
import static org.testcontainers.utility.MountableFile.forHostPath;

public class ElasticsearchServer
implements Closeable
{
public static final String ELASTICSEARCH_7_IMAGE = "elasticsearch:7.16.2";
public static final String ELASTICSEARCH_8_IMAGE = "elasticsearch:8.11.3";
Expand Down Expand Up @@ -95,7 +97,8 @@ public ElasticsearchServer(Network network, String image)
container.start();
}

public void stop()
@Override
public void close()
throws IOException
{
container.close();
Expand Down

0 comments on commit 2a36038

Please sign in to comment.