bharos opened a new pull request, #9026:
URL: https://github.com/apache/gravitino/pull/9026
<!--
1. Title: [#<issue>] <type>(<scope>): <subject>
Examples:
- "[#123] feat(operator): support xxx"
- "[#233] fix: check null before access result in xxx"
- "[MINOR] refactor: fix typo in variable name"
- "[MINOR] docs: fix typo in README"
- "[#255] test: fix flaky test NameOfTheTest"
Reference: https://www.conventionalcommits.org/en/v1.0.0/
2. If the PR is unfinished, please mark this PR as draft.
-->
### What changes were proposed in this pull request?
- Use getMappedPort() instead of hardcoded PG_PORT for proper Docker port
mapping
- Replace getContainerIpAddress() with container.getHost() for host
accessibility
- Add connection timeouts (30s) to prevent hanging connections
### Why are the changes needed?
Fixes PostgreSQL connection failures where tests tried to connect to
internal container network instead of host-mapped ports.
The Problem:
- Tests were using getContainerIpAddress():5432 which points to internal
Docker network (e.g., 172.17.0.2:5432)
- This internal address is not accessible from the host running the tests
- Docker maps container port 5432 to a random host port (e.g.,
localhost:32768)
- Without timeouts, failed connections would hang indefinitely, causing test
timeouts
The Solution:
- Use container.getHost():getMappedPort(5432) to get the actual accessible
endpoint
- Add connection timeouts to fail fast instead of hanging
### Does this PR introduce _any_ user-facing change?
No user-facing changes. This is an internal test infrastructure fix.
### How was this patch tested?
Local Testing:
Ran PostgreSQL integration tests locally to verify connectivity works
Confirmed JDBC URLs now generate correct host-mapped ports
Verified connection timeouts prevent hanging
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]