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
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
import io.trino.tpch.TpchTable;
import org.intellij.lang.annotations.Language;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
Expand Down Expand Up @@ -64,15 +66,14 @@ public static QueryRunner createRaptorQueryRunner(
queryRunner.createCatalog("tpch", "tpch");

queryRunner.installPlugin(new RaptorPlugin());
File baseDir = queryRunner.getCoordinator().getBaseDataDir().toFile();
Map<String, String> raptorProperties = ImmutableMap.<String, String>builder()
.putAll(extraRaptorProperties)
.put("metadata.db.type", "h2")
.put("metadata.db.filename", new File(baseDir, "db").getAbsolutePath())
.put("storage.data-directory", new File(baseDir, "data").getAbsolutePath())
.put("metadata.db.filename", createTempDirectory("raptor-db").toString())
.put("storage.data-directory", createTempDirectory("raptor-data").toString())
.put("storage.max-shard-rows", "2000")
.put("backup.provider", "file")
.put("backup.directory", new File(baseDir, "backup").getAbsolutePath())
.put("backup.directory", createTempDirectory("raptor-backup").toString())
.buildOrThrow();

queryRunner.createCatalog("raptor", "raptor_legacy", raptorProperties);
Expand Down Expand Up @@ -163,6 +164,14 @@ public static Session createSession(String schema)
.build();
}

public static Path createTempDirectory(String name)
throws IOException
{
Path tempDirectory = Files.createTempDirectory(name);
tempDirectory.toFile().deleteOnExit();
return tempDirectory.toAbsolutePath();
}

public static void main(String[] args)
throws Exception
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,15 @@
import io.trino.testing.DistributedQueryRunner;
import io.trino.testing.QueryRunner;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.TestInstance;
import org.testcontainers.containers.MySQLContainer;

import java.io.File;
import java.util.Map;

import static io.trino.plugin.raptor.legacy.RaptorQueryRunner.copyTables;
import static io.trino.plugin.raptor.legacy.RaptorQueryRunner.createSession;
import static io.trino.plugin.raptor.legacy.RaptorQueryRunner.createTempDirectory;
import static java.lang.String.format;
import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS;

@TestInstance(PER_CLASS)
public class TestRaptorMySqlConnectorTest
extends BaseRaptorConnectorTest
{
Expand Down Expand Up @@ -68,15 +65,14 @@ private static QueryRunner createRaptorMySqlQueryRunner(String mysqlUrl)
queryRunner.createCatalog("tpch", "tpch");

queryRunner.installPlugin(new RaptorPlugin());
File baseDir = queryRunner.getCoordinator().getBaseDataDir().toFile();
Map<String, String> raptorProperties = ImmutableMap.<String, String>builder()
.put("metadata.db.type", "mysql")
.put("metadata.db.url", mysqlUrl)
.put("storage.compaction-enabled", "false")
.put("storage.data-directory", new File(baseDir, "data").getAbsolutePath())
.put("storage.data-directory", createTempDirectory("raptor-db").toString())
.put("storage.max-shard-rows", "2000")
.put("backup.provider", "file")
.put("backup.directory", new File(baseDir, "backup").getAbsolutePath())
.put("backup.directory", createTempDirectory("raptor-db").toString())
.buildOrThrow();

queryRunner.createCatalog("raptor", "raptor_legacy", raptorProperties);
Expand Down