Skip to content

fix(trino): resolve mapped host port in get_connection_url - #1119

Open
BrunosGits wants to merge 1 commit into
testcontainers:mainfrom
BrunosGits:fix/1111-trino-port
Open

BrunosGits wants to merge 1 commit into
testcontainers:mainfrom
BrunosGits:fix/1111-trino-port

Conversation

@BrunosGits

Copy link
Copy Markdown

Summary

Fixes #1111: TrinoContainer.get_connection_url() interpolated self.port (the fixed container-internal 8080) instead of resolving the mapped host port, so the returned URL could never connect.

Root cause

Docker maps the exposed 8080 to a random host port, but get_connection_url never called get_exposed_port(). Sibling modules (CockroachDB, CrateDB) already resolve through _create_connection_url(); Trino was an isolated miss - the existing test even works around it by calling get_exposed_port itself.

Changes

  • src/testcontainers/community/trino/init.py: one line - self.get_exposed_port(self.port) instead of self.port.
  • tests/community/trino/test_trino_url.py: new mock-based regression test (no daemon, image, or trino client lib needed) asserting the URL carries the mapped port and the lookup used 8080.

Testing

  • New test fails pre-fix (URL carries 8080) and passes post-fix.
  • ruff check + ruff format clean.

Closes #1111

@BrunosGits

Copy link
Copy Markdown
Author

testcontainers-python #1119 (Python #1111 - Trino Port)

CI run expired — needs maintainer action

The GitHub Actions run (#35251944771) expired after 30 days in the fork approval gate. This is a GitHub security feature: workflows from fork PRs require manual approval by a maintainer with write access to testcontainers/testcontainers-python.

PR status: Open, mergeable. Code is ready — TDD green (mock regression test passes), ruff clean.

Options to unblock:

  1. Approve CI on this fork PR — Go to Actions tab → "core" workflow → click "Approve and run"
  2. Push this branch to the main repo — git push upstream fix/1111-trino-port (requires write access)
  3. Enable fork PR Actions — Repo Settings → Actions → General → check "Allow GitHub Actions to run on pull requests from forks"

Maintainers — any of the above would unblock. Thanks!


This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TrinoContainer.get_connection_url() returns the internal port, not the mapped host port

1 participant