Skip to content

Append URL parameters in TrinoContainer.getJdbcUrl() - #12073

Open
Gaurav1112 wants to merge 1 commit into
testcontainers:mainfrom
Gaurav1112:fix/trino-url-parameters
Open

Append URL parameters in TrinoContainer.getJdbcUrl()#12073
Gaurav1112 wants to merge 1 commit into
testcontainers:mainfrom
Gaurav1112:fix/trino-url-parameters

Conversation

@Gaurav1112

@Gaurav1112 Gaurav1112 commented Sep 11, 2026

Copy link
Copy Markdown

JdbcDatabaseContainer.withUrlParam(...) is a silent no-op on TrinoContainer: parameters are stored in urlParameters, but they only reach the JDBC URL if the subclass's getJdbcUrl() appends constructUrlParameters(...) — and Trino's never did. Every other non-Oracle JdbcDatabaseContainer subclass (MySQL, PostgreSQL, MariaDB, TiDB, CockroachDB, Db2, MSSQLServer, ClickHouse, CrateDB, OceanBase, Timeplus, Databend, YugabyteDB) applies the idiom; Oracle is a deliberate exception (thin-URL syntax). The gap traces to the withUrlParam rollout in #1874 (2019), which predated Presto's fix — Trino was created by copying Presto, and the new org.testcontainers.trino package copied it again.

The Trino JDBC driver supports URL query parameters (jdbc:trino://host:port/catalog?prop=value — SSL, applicationNamePrefix, session properties), so the dropped setting is meaningful, and because the failure mode leaves defaults in place there is no error pointing at Testcontainers.

This change appends constructUrlParameters("?", "&") in both the org.testcontainers.trino.TrinoContainer and the deprecated org.testcontainers.containers.TrinoContainer (the frozen Presto module is left untouched), and adds testWithAdditionalUrlParamInJdbcUrl mirroring the existing MySQL test of the same name. Verified against a live trinodb/trino:476 container: the test fails before the change (URL contains no ?) and passes after, including a SELECT 1 through createConnection() over the parameterized URL. spotlessApply produced no further changes.

Prepared with the assistance of Claude (Anthropic); the failing/passing runs against the live container were verified by execution.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Trino JDBC URLs now include configured connection parameters, such as catalog settings.
    • Queries using these parameters now work correctly through the generated connection URL.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Gaurav1112
Gaurav1112 requested a review from a team as a code owner September 11, 2026 20:40
@coderabbitai

coderabbitai Bot commented Sep 11, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: e4e152cb-79b3-4024-8f70-36239e81d87f

📥 Commits

Reviewing files that changed from the base of the PR and between 8e54951 and 3373fc6.

📒 Files selected for processing (3)
  • modules/trino/src/main/java/org/testcontainers/containers/TrinoContainer.java
  • modules/trino/src/main/java/org/testcontainers/trino/TrinoContainer.java
  • modules/trino/src/test/java/org/testcontainers/trino/TrinoContainerTest.java

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

TrinoContainer.getJdbcUrl() now includes configured URL parameters. A test configures applicationNamePrefix, checks the generated JDBC URL, and runs SELECT 1.

Changes

Trino JDBC URL parameters

Layer / File(s) Summary
JDBC URL parameter propagation and validation
modules/trino/src/main/java/org/testcontainers/containers/TrinoContainer.java, modules/trino/src/main/java/org/testcontainers/trino/TrinoContainer.java, modules/trino/src/test/java/org/testcontainers/trino/TrinoContainerTest.java
Both TrinoContainer implementations append configured URL parameters to the JDBC URL. The test verifies applicationNamePrefix and a successful JDBC query.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: eddumelendez

Merge Risk: ⚪ Minimal · up to 3373f

Configured Trino JDBC URL parameters are propagated and validated by integration coverage; no actionable merge risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: appending URL parameters in TrinoContainer.getJdbcUrl().
Description check ✅ Passed The description explains the defect, affected implementations, rationale, implementation, test coverage, and verification results. It meets the repository template requirements.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant