Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions plugin/trino-singlestore/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.trino</groupId>
<artifactId>trino-testing-containers</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.trino</groupId>
<artifactId>trino-testing-services</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public DistributedQueryRunner build()
queryRunner.installPlugin(new SingleStorePlugin());
queryRunner.createCatalog("singlestore", "singlestore", connectorProperties);

queryRunner.execute("CREATE SCHEMA tpch");
queryRunner.execute("CREATE SCHEMA IF NOT EXISTS tpch");
copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, initialTables);

return queryRunner;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,17 @@
import org.testcontainers.containers.JdbcDatabaseContainer;
import org.testcontainers.utility.DockerImageName;

import java.io.Closeable;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Set;

import static io.trino.testing.containers.TestContainers.startOrReuse;

public class TestingSingleStoreServer
extends JdbcDatabaseContainer<TestingSingleStoreServer>
{
Expand All @@ -33,6 +38,8 @@ public class TestingSingleStoreServer

public static final Integer SINGLESTORE_PORT = 3306;

private final Closeable cleanup;

public TestingSingleStoreServer()
{
this(DEFAULT_VERSION);
Expand All @@ -43,7 +50,7 @@ public TestingSingleStoreServer(String version)
super(DockerImageName.parse(DEFAULT_TAG));
addEnv("ROOT_PASSWORD", "memsql_root_password");
addEnv("SINGLESTORE_VERSION", version);
start();
cleanup = startOrReuse(this);
}

@Override
Expand Down Expand Up @@ -89,6 +96,17 @@ public String getTestQueryString()
return "SELECT 1";
}

@Override
public void close()
{
try {
cleanup.close();
}
catch (IOException e) {
throw new UncheckedIOException(e);
}
}

public void execute(String sql)
{
execute(sql, getUsername(), getPassword());
Expand Down