Skip to content

fix(build): Upgrade testconatiners to 2.0.3#27140

Merged
tdcmeehan merged 1 commit intoprestodb:masterfrom
yhwang:update-testcontainers
Feb 14, 2026
Merged

fix(build): Upgrade testconatiners to 2.0.3#27140
tdcmeehan merged 1 commit intoprestodb:masterfrom
yhwang:update-testcontainers

Conversation

@yhwang
Copy link
Copy Markdown
Member

@yhwang yhwang commented Feb 13, 2026

Description

The current image that runs the CI builds is using the new Docker engine and requires the client version be higher than 1.44. The default client version that is used by the current testcontainer is 1.32 and causes build failures.

Upgrade the testcontainers to 2.0.3, related dependencies, and update test cases accordingly.

Motivation and Context

The CI builds fail on lots of PRs, and the root cause is that the version of the testcontainers is using an old Docker client, which got rejected by the Docker engine that runs on the build image.

Impact

Only on the build CI and running the testing locally for those projects that are using testcontainers.

Test Plan

I manually ran projects using testcontainers, and all passed, including:

  • presto-clickhouse
  • presto-elasticsearch
  • presto-main
  • presto-mysql
  • presto-postgresql
  • presto-singlestore

Wait for the CI to run through all other test suites.

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.
  • If adding new dependencies, verified they have an OpenSSF Scorecard score of 5.0 or higher (or obtained explicit TSC approval for lower scores).

Release Notes

Please follow release notes guidelines and fill in the release notes below.

== NO RELEASE NOTE ==

Summary by Sourcery

Upgrade Testcontainers to version 2.0.3 across the project and update dependent test modules to align with the new artifacts and APIs.

Enhancements:

  • Align ClickHouse, MySQL, PostgreSQL, Elasticsearch, and SingleStore test modules with the new Testcontainers module artifact names.
  • Adjust JDBC URL and credential handling for ClickHouse tests to use container-provided connection metadata.
  • Simplify MySQL and PostgreSQL Testcontainers usage by removing unnecessary generics and standardizing container initialization in tests.

Build:

  • Bump the global Testcontainers dependency version from 1.20.5 to 2.0.3 to support newer Docker client requirements in CI.

The current image that runs the CI builds is using the new Docker engine and
requires the client version be higher than 1.44. The default client
version that is used by the current testcontainer is 1.32 and causes
build failures.

Upgrade the testcontainers to 2.0.3, related dependencies, and update
test cases accordingly.

Signed-off-by: Yihong Wang <yh.wang@ibm.com>
@yhwang yhwang requested a review from a team as a code owner February 13, 2026 21:05
@prestodb-ci prestodb-ci added the from:IBM PR from IBM label Feb 13, 2026
@prestodb-ci prestodb-ci requested review from a team, ScrapCodes and aaneja and removed request for a team February 13, 2026 21:05
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Feb 13, 2026

Reviewer's Guide

Upgrades Testcontainers to 2.0.3 and adapts test dependencies and test code (ClickHouse, MySQL, PostgreSQL, Elasticsearch, Hydra OAuth tests) to the new module layout and container APIs so CI and local tests run against a newer Docker client.

Sequence diagram for running an integration test with Testcontainers 2.0.3

sequenceDiagram
    actor Developer
    participant Maven as Maven_Surefire
    participant TestClass as IntegrationTestClass
    participant TC as Testcontainers_2_0_3
    participant Docker as Docker_engine
    participant DB as Database_container

    Developer->>Maven: mvn test
    Maven->>TestClass: execute test methods

    TestClass->>TC: request container start
    TC->>Docker: create_container
    Docker-->>TC: container_id
    TC->>Docker: start_container(container_id)
    Docker-->>TC: container_started
    TC-->>TestClass: running_container_info

    TestClass->>DB: open_connection_using_JDBC_URL
    DB-->>TestClass: connection_established
    TestClass->>DB: run_integration_queries
    DB-->>TestClass: query_results

    TestClass-->>Maven: test_passed

    Maven->>TC: shutdown_all_containers
    TC->>Docker: stop_container(container_id)
    Docker-->>TC: container_stopped
    TC->>Docker: remove_container(container_id)
    Docker-->>TC: container_removed
Loading

File-Level Changes

Change Details Files
Update Testcontainers version and module artifact IDs to 2.x coordinates across the build.
  • Bump parent POM property dep.testcontainers.version from 1.20.5 to 2.0.3
  • Switch module-specific dependencies to new 2.x artifact IDs (e.g., clickhouse → testcontainers-clickhouse, jdbc → testcontainers-jdbc, mysql → testcontainers-mysql, postgresql → testcontainers-postgresql, elasticsearch → testcontainers-elasticsearch) while retaining test scope
pom.xml
presto-clickhouse/pom.xml
presto-main/pom.xml
presto-elasticsearch/pom.xml
presto-mysql/pom.xml
presto-postgresql/pom.xml
presto-singlestore/pom.xml
Adapt ClickHouse test helper and query runner to the new Testcontainers ClickHouse module and JDBC URL handling.
  • Update ClickHouseContainer import to org.testcontainers.clickhouse.ClickHouseContainer
  • Use container-provided JDBC URL via getJdbcUrl() instead of manually constructing it with host and mapped port
  • Include username and password when creating JDBC connections in TestingClickHouseServer.execute
  • Pass ClickHouse container username/password as connector properties in ClickHouseQueryRunner so tests authenticate correctly
presto-clickhouse/src/test/java/com/facebook/presto/plugin/clickhouse/TestingClickHouseServer.java
presto-clickhouse/src/test/java/com/facebook/presto/plugin/clickhouse/ClickHouseQueryRunner.java
Adjust MySQL test classes to the updated MySQLContainer API and remove unnecessary generic type usage.
  • Change MySQLContainer field, parameter, and helper method signatures from MySQLContainer<?> to raw MySQLContainer, aligning with new module API
  • Update container instantiations from new MySQLContainer<>("mysql:8.0") to new MySQLContainer("mysql:8.0") in all MySQL test suites
presto-mysql/src/test/java/com/facebook/presto/plugin/mysql/TestCredentialPassthrough.java
presto-mysql/src/test/java/com/facebook/presto/plugin/mysql/TestMySqlDistributedQueries.java
presto-mysql/src/test/java/com/facebook/presto/plugin/mysql/TestMySqlIntegrationMixedCaseTest.java
presto-mysql/src/test/java/com/facebook/presto/plugin/mysql/TestMySqlIntegrationSmokeTest.java
presto-mysql/src/test/java/com/facebook/presto/plugin/mysql/TestMySqlTypeMapping.java
Adjust PostgreSQL-based tests and utilities to the updated PostgreSQLContainer API.
  • Change PostgreSQLContainer fields, parameters, and helper method signatures from PostgreSQLContainer<?> to PostgreSQLContainer
  • Update container construction to explicitly specify the postgres:14 image where needed, including OAuth Hydra test database container
presto-postgresql/src/test/java/com/facebook/presto/plugin/postgresql/TestPostgreSqlCaseInsensitiveMapping.java
presto-postgresql/src/test/java/com/facebook/presto/plugin/postgresql/TestPostgreSqlCaseSensitiveMapping.java
presto-postgresql/src/test/java/com/facebook/presto/plugin/postgresql/TestPostgreSqlDistributedQueries.java
presto-postgresql/src/test/java/com/facebook/presto/plugin/postgresql/TestPostgreSqlIntegrationSmokeTest.java
presto-postgresql/src/test/java/com/facebook/presto/plugin/postgresql/TestPostgreSqlTypeMapping.java
presto-main/src/test/java/com/facebook/presto/server/security/oauth2/TestingHydraIdentityProvider.java
presto-postgresql/src/test/java/com/facebook/presto/plugin/postgresql/PostgreSqlQueryRunner.java

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • In TestPostgreSqlDistributedQueries and TestPostgreSqlIntegrationSmokeTest, the postgresContainer field no longer appears to be reassigned, so it can remain final for consistency with the other tests and to make the immutability explicit.
  • The hard-coded "postgres:14" image tag is now duplicated across several test classes (including TestingHydraIdentityProvider); consider extracting this to a shared constant to keep the version aligned and make future upgrades simpler.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `TestPostgreSqlDistributedQueries` and `TestPostgreSqlIntegrationSmokeTest`, the `postgresContainer` field no longer appears to be reassigned, so it can remain `final` for consistency with the other tests and to make the immutability explicit.
- The hard-coded `"postgres:14"` image tag is now duplicated across several test classes (including `TestingHydraIdentityProvider`); consider extracting this to a shared constant to keep the version aligned and make future upgrades simpler.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@yhwang
Copy link
Copy Markdown
Member Author

yhwang commented Feb 14, 2026

The comments from sourcery-ai seem minor to me, and that code is for testing only. Let me know if you think I need to address them. Otherwise, I think it's good to go.

@tdcmeehan
Copy link
Copy Markdown
Contributor

Agreed, let's ship it.

@tdcmeehan tdcmeehan merged commit ef9ef78 into prestodb:master Feb 14, 2026
93 of 96 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

from:IBM PR from IBM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants