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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<dep.jaxb.version>2.3.1</dep.jaxb.version>
<dep.jaxb.runtime.version>4.0.6</dep.jaxb.runtime.version>
<dep.hudi.version>0.14.0</dep.hudi.version>
<dep.testcontainers.version>1.20.5</dep.testcontainers.version>
<dep.testcontainers.version>2.0.3</dep.testcontainers.version>
<dep.docker-java.version>3.4.1</dep.docker-java.version>
<dep.jayway.version>2.9.0</dep.jayway.version>
<dep.ratis.version>3.1.3</dep.ratis.version>
Expand Down
4 changes: 2 additions & 2 deletions presto-clickhouse/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,13 @@

<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>clickhouse</artifactId>
<artifactId>testcontainers-clickhouse</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>jdbc</artifactId>
<artifactId>testcontainers-jdbc</artifactId>
<scope>test</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ public static DistributedQueryRunner createClickHouseQueryRunner(

connectorProperties = new HashMap<>(ImmutableMap.copyOf(connectorProperties));
connectorProperties.putIfAbsent("clickhouse.connection-url", server.getJdbcUrl());
connectorProperties.putIfAbsent("clickhouse.connection-user", server.getClickHouseContainer().getUsername());
connectorProperties.putIfAbsent("clickhouse.connection-password", server.getClickHouseContainer().getPassword());
connectorProperties.putIfAbsent("clickhouse.allow-drop-table", String.valueOf(true));
connectorProperties.putIfAbsent("clickhouse.map-string-as-varchar", String.valueOf(true));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,13 @@
*/
package com.facebook.presto.plugin.clickhouse;

import org.testcontainers.containers.ClickHouseContainer;
import org.testcontainers.clickhouse.ClickHouseContainer;

import java.io.Closeable;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;

import static java.lang.String.format;
import static org.testcontainers.containers.ClickHouseContainer.HTTP_PORT;

public class TestingClickHouseServer
implements Closeable
{
Expand All @@ -44,7 +41,10 @@ public ClickHouseContainer getClickHouseContainer()
}
public void execute(String sql)
{
try (Connection connection = DriverManager.getConnection(getJdbcUrl());
try (Connection connection = DriverManager.getConnection(
getJdbcUrl(),
dockerContainer.getUsername(),
dockerContainer.getPassword());
Statement statement = connection.createStatement()) {
statement.execute(sql);
}
Expand All @@ -55,10 +55,7 @@ public void execute(String sql)

public String getJdbcUrl()
{
String s = format("jdbc:clickhouse://%s:%s/", dockerContainer.getContainerIpAddress(),
dockerContainer.getMappedPort(HTTP_PORT));
return format("jdbc:clickhouse://%s:%s/", dockerContainer.getContainerIpAddress(),
dockerContainer.getMappedPort(HTTP_PORT));
return dockerContainer.getJdbcUrl();
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion presto-elasticsearch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@

<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>elasticsearch</artifactId>
<artifactId>testcontainers-elasticsearch</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
Expand Down
4 changes: 2 additions & 2 deletions presto-main/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -472,10 +472,10 @@

<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>postgresql</artifactId>
<artifactId>testcontainers-postgresql</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.github.luben</groupId>
<artifactId>zstd-jni</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@
import org.testcontainers.containers.FixedHostPortGenericContainer;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.Network;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.containers.startupcheck.OneShotStartupCheckStrategy;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.containers.wait.strategy.WaitAllStrategy;
import org.testcontainers.postgresql.PostgreSQLContainer;
import org.testcontainers.utility.MountableFile;

import java.io.Closeable;
Expand Down Expand Up @@ -75,7 +75,7 @@ public class TestingHydraIdentityProvider

private final Network network = Network.newNetwork();

private final PostgreSQLContainer<?> databaseContainer = new PostgreSQLContainer<>()
private final PostgreSQLContainer databaseContainer = new PostgreSQLContainer("postgres:14")
.withNetwork(network)
.withNetworkAliases("database")
.withUsername("hydra")
Expand Down
2 changes: 1 addition & 1 deletion presto-mysql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@

<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>mysql</artifactId>
<artifactId>testcontainers-mysql</artifactId>
<scope>test</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import com.facebook.presto.testing.QueryRunner;
import com.facebook.presto.tests.DistributedQueryRunner;
import com.google.common.collect.ImmutableMap;
import org.testcontainers.containers.MySQLContainer;
import org.testcontainers.mysql.MySQLContainer;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;

Expand All @@ -40,13 +40,13 @@ public class TestCredentialPassthrough
private static final String TEST_USER = "testuser";
private static final String TEST_PASSWORD = "testpass";

private final MySQLContainer<?> mysqlContainer;
private final MySQLContainer mysqlContainer;
private final QueryRunner mySqlQueryRunner;

public TestCredentialPassthrough()
throws Exception
{
mysqlContainer = new MySQLContainer<>("mysql:8.0")
mysqlContainer = new MySQLContainer("mysql:8.0")
.withDatabaseName(TEST_SCHEMA)
.withUsername(TEST_USER)
.withPassword(TEST_PASSWORD);
Expand Down Expand Up @@ -77,7 +77,7 @@ public void testCredentialPassthrough()
mySqlQueryRunner.execute(getSession(mysqlContainer), "CREATE TABLE test_create (a bigint, b double, c varchar)");
}

public static QueryRunner createQueryRunner(MySQLContainer<?> mysqlContainer)
public static QueryRunner createQueryRunner(MySQLContainer mysqlContainer)
throws Exception
{
DistributedQueryRunner queryRunner = null;
Expand All @@ -99,7 +99,7 @@ public static QueryRunner createQueryRunner(MySQLContainer<?> mysqlContainer)
}
}

private static Session getSession(MySQLContainer<?> mysqlContainer)
private static Session getSession(MySQLContainer mysqlContainer)
{
Map<String, String> extraCredentials = ImmutableMap.of("mysql.user", mysqlContainer.getUsername(), "mysql.password", mysqlContainer.getPassword());
return testSessionBuilder()
Expand All @@ -116,7 +116,7 @@ private static Session getSession(MySQLContainer<?> mysqlContainer)
.build();
}

private static String getConnectionUrl(MySQLContainer<?> mysqlContainer)
private static String getConnectionUrl(MySQLContainer mysqlContainer)
{
String jdbcUrlWithoutDatabase = removeDatabaseFromJdbcUrl(mysqlContainer.getJdbcUrl());
return format("%s?useSSL=false&allowPublicKeyRetrieval=true", jdbcUrlWithoutDatabase.split("\\?")[0]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import com.facebook.presto.tests.AbstractTestDistributedQueries;
import com.google.common.collect.ImmutableMap;
import io.airlift.tpch.TpchTable;
import org.testcontainers.containers.MySQLContainer;
import org.testcontainers.mysql.MySQLContainer;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Optional;
import org.testng.annotations.Test;
Expand All @@ -33,11 +33,11 @@
public class TestMySqlDistributedQueries
extends AbstractTestDistributedQueries
{
private final MySQLContainer<?> mysqlContainer;
private final MySQLContainer mysqlContainer;

public TestMySqlDistributedQueries()
{
this.mysqlContainer = new MySQLContainer<>("mysql:8.0")
this.mysqlContainer = new MySQLContainer("mysql:8.0")
.withDatabaseName("tpch")
.withUsername("testuser")
.withPassword("testpass");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import com.facebook.presto.tests.AbstractTestQueryFramework;
import com.google.common.collect.ImmutableMap;
import io.airlift.tpch.TpchTable;
import org.testcontainers.containers.MySQLContainer;
import org.testcontainers.mysql.MySQLContainer;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;

Expand All @@ -40,12 +40,12 @@
public class TestMySqlIntegrationMixedCaseTest
extends AbstractTestQueryFramework
{
private final MySQLContainer<?> mysqlContainer;
private final MySQLContainer mysqlContainer;

public TestMySqlIntegrationMixedCaseTest()
throws Exception
{
this.mysqlContainer = new MySQLContainer<>("mysql:8.0")
this.mysqlContainer = new MySQLContainer("mysql:8.0")
.withDatabaseName("tpch")
.withUsername("testuser")
.withPassword("testpass");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import org.intellij.lang.annotations.Language;
import org.testcontainers.containers.MySQLContainer;
import org.testcontainers.mysql.MySQLContainer;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;

Expand All @@ -48,12 +48,12 @@
public class TestMySqlIntegrationSmokeTest
extends AbstractTestIntegrationSmokeTest
{
private final MySQLContainer<?> mysqlContainer;
private final MySQLContainer mysqlContainer;

public TestMySqlIntegrationSmokeTest()
throws Exception
{
this.mysqlContainer = new MySQLContainer<>("mysql:8.0")
this.mysqlContainer = new MySQLContainer("mysql:8.0")
.withDatabaseName("tpch")
.withUsername("testuser")
.withPassword("testpass");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import com.facebook.presto.tests.sql.PrestoSqlExecutor;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import org.testcontainers.containers.MySQLContainer;
import org.testcontainers.mysql.MySQLContainer;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;

Expand Down Expand Up @@ -66,11 +66,11 @@ public class TestMySqlTypeMapping
{
private static final String CHARACTER_SET_UTF8 = "CHARACTER SET utf8";

private final MySQLContainer<?> mysqlContainer;
private final MySQLContainer mysqlContainer;

public TestMySqlTypeMapping()
{
this.mysqlContainer = new MySQLContainer<>("mysql:8.0")
this.mysqlContainer = new MySQLContainer("mysql:8.0")
.withDatabaseName("tpch")
.withUsername("testuser")
.withPassword("testpass");
Expand Down
2 changes: 1 addition & 1 deletion presto-postgresql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@

<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>postgresql</artifactId>
<artifactId>testcontainers-postgresql</artifactId>
<scope>test</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import com.facebook.presto.tpch.TpchPlugin;
import com.google.common.collect.ImmutableMap;
import io.airlift.tpch.TpchTable;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.postgresql.PostgreSQLContainer;

import java.sql.Connection;
import java.sql.DriverManager;
Expand Down Expand Up @@ -93,7 +93,7 @@ private static void createSchema(String url, String schema, String username, Str
}
}

public static Properties createJdbcProperties(PostgreSQLContainer<?> container)
public static Properties createJdbcProperties(PostgreSQLContainer container)
{
Properties properties = new Properties();
properties.setProperty("user", container.getUsername());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.postgresql.PostgreSQLContainer;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;

Expand All @@ -37,11 +37,11 @@
public class TestPostgreSqlCaseInsensitiveMapping
extends AbstractTestQueryFramework
{
private final PostgreSQLContainer<?> postgresContainer;
private final PostgreSQLContainer postgresContainer;

public TestPostgreSqlCaseInsensitiveMapping()
{
this.postgresContainer = new PostgreSQLContainer<>("postgres:14")
this.postgresContainer = new PostgreSQLContainer("postgres:14")
.withDatabaseName("tpch")
.withUsername("testuser")
.withPassword("testpass");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import com.facebook.presto.tests.AbstractTestQueryFramework;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.postgresql.PostgreSQLContainer;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;

Expand All @@ -31,11 +31,11 @@
public class TestPostgreSqlCaseSensitiveMapping
extends AbstractTestQueryFramework
{
private final PostgreSQLContainer<?> postgresContainer;
private final PostgreSQLContainer postgresContainer;

public TestPostgreSqlCaseSensitiveMapping()
{
this.postgresContainer = new PostgreSQLContainer<>("postgres:14")
this.postgresContainer = new PostgreSQLContainer("postgres:14")
.withDatabaseName("tpch")
.withUsername("testuser")
.withPassword("testpass");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import com.facebook.presto.tests.AbstractTestDistributedQueries;
import com.google.common.collect.ImmutableMap;
import io.airlift.tpch.TpchTable;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.postgresql.PostgreSQLContainer;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;

Expand All @@ -27,11 +27,11 @@
public class TestPostgreSqlDistributedQueries
extends AbstractTestDistributedQueries
{
private final PostgreSQLContainer<?> postgresContainer;
private PostgreSQLContainer postgresContainer;

public TestPostgreSqlDistributedQueries()
{
this.postgresContainer = new PostgreSQLContainer<>("postgres:14")
this.postgresContainer = new PostgreSQLContainer("postgres:14")
.withDatabaseName("tpch")
.withUsername("testuser")
.withPassword("testpass");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import org.intellij.lang.annotations.Language;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.postgresql.PostgreSQLContainer;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;

Expand All @@ -42,11 +42,11 @@
public class TestPostgreSqlIntegrationSmokeTest
extends AbstractTestIntegrationSmokeTest
{
private final PostgreSQLContainer<?> postgresContainer;
private PostgreSQLContainer postgresContainer;

public TestPostgreSqlIntegrationSmokeTest()
{
this.postgresContainer = new PostgreSQLContainer<>("postgres:14")
this.postgresContainer = new PostgreSQLContainer("postgres:14")
.withDatabaseName("tpch")
.withUsername("testuser")
.withPassword("testpass");
Expand Down
Loading
Loading