From 13397fc04ff9698a38e199fb711c348c23e422ec Mon Sep 17 00:00:00 2001 From: Yuya Ebihara Date: Wed, 21 Aug 2024 10:29:30 +0200 Subject: [PATCH] Make docker image name in PostgreSQL query runner configurable --- .../io/trino/plugin/postgresql/PostgreSqlQueryRunner.java | 3 ++- .../io/trino/plugin/postgresql/TestingPostgreSqlServer.java | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plugin/trino-postgresql/src/test/java/io/trino/plugin/postgresql/PostgreSqlQueryRunner.java b/plugin/trino-postgresql/src/test/java/io/trino/plugin/postgresql/PostgreSqlQueryRunner.java index 8a9bd1fe68417..605296aa4a05c 100644 --- a/plugin/trino-postgresql/src/test/java/io/trino/plugin/postgresql/PostgreSqlQueryRunner.java +++ b/plugin/trino-postgresql/src/test/java/io/trino/plugin/postgresql/PostgreSqlQueryRunner.java @@ -27,6 +27,7 @@ import java.util.Map; import static io.airlift.testing.Closeables.closeAllSuppress; +import static io.trino.plugin.postgresql.TestingPostgreSqlServer.DEFAULT_IMAGE_NAME; import static io.trino.plugin.tpch.TpchMetadata.TINY_SCHEMA_NAME; import static io.trino.testing.QueryAssertions.copyTpchTables; import static io.trino.testing.TestingSession.testSessionBuilder; @@ -102,7 +103,7 @@ public DistributedQueryRunner build() public static void main(String[] args) throws Exception { - QueryRunner queryRunner = builder(new TestingPostgreSqlServer(true)) + QueryRunner queryRunner = builder(new TestingPostgreSqlServer(System.getProperty("testing.postgresql-image-name", DEFAULT_IMAGE_NAME), true)) .addCoordinatorProperty("http-server.http.port", "8080") .setInitialTables(TpchTable.getTables()) .build(); diff --git a/plugin/trino-postgresql/src/test/java/io/trino/plugin/postgresql/TestingPostgreSqlServer.java b/plugin/trino-postgresql/src/test/java/io/trino/plugin/postgresql/TestingPostgreSqlServer.java index 7e018e3775156..7871c53a91109 100644 --- a/plugin/trino-postgresql/src/test/java/io/trino/plugin/postgresql/TestingPostgreSqlServer.java +++ b/plugin/trino-postgresql/src/test/java/io/trino/plugin/postgresql/TestingPostgreSqlServer.java @@ -53,6 +53,8 @@ public class TestingPostgreSqlServer implements AutoCloseable { + public static final String DEFAULT_IMAGE_NAME = "postgres:11"; + private static final String USER = "test"; private static final String PASSWORD = "test"; private static final String DATABASE = "tpch"; @@ -77,7 +79,7 @@ public TestingPostgreSqlServer() public TestingPostgreSqlServer(boolean shouldExposeFixedPorts) { // Use the oldest supported PostgreSQL version - this("postgres:11", shouldExposeFixedPorts); + this(DEFAULT_IMAGE_NAME, shouldExposeFixedPorts); } public TestingPostgreSqlServer(String dockerImageName, boolean shouldExposeFixedPorts)