nevzheng opened a new issue, #14117:
URL: https://github.com/apache/gravitino/issues/14117

   ### What would you like to be improved?
   
   Integration tests reach their containers by Docker bridge IP. 
`BaseContainer.getContainerIpAddress()` returns the container's address on 
Docker's network, and about 97 test files build `ip:port` strings from it.
   
   - **It only works where the test JVM can route to Docker's network.** Linux 
CI can; macOS (Docker Desktop, OrbStack) cannot, so the build needs the 
mac-docker-connector workaround and a fixed subnet, and only one test run per 
Mac works at a time.
   - **Every test rebuilds addresses itself,** for JDBC URLs, Thrift URIs, HDFS 
URIs and Kafka bootstrap servers, so the same knowledge is copied into ~97 
files.
   - **Tests can only run against containers started on local Docker.** They 
cannot point at the same services running elsewhere, such as a Kubernetes test 
cluster or a shared environment.
   - Testcontainers already provides the right mechanism (`getHost()` + 
`getMappedPort()` from the test, network aliases between containers); Gravitino 
bypasses it.
   
   ### How should we improve?
   
   Tests reach containers only through accessors on the container class: 
`hive.metastoreUri()`, `hive.hdfsUri()`, `hive.hdfsConfiguration()`, 
`mysql.jdbcUrl()`, `kafka.bootstrapServers()`. A container has two backings:
   
   1. **Managed** (default): Testcontainers starts it; accessors use the host 
and mapped ports, or the official module's own accessors.
   2. **External**: nothing is started; accessors read 
`gravitino.test.<service>.<key>` from a system property, an environment 
variable (`GRAVITINO_TEST_HIVE_METASTORE_URI`) or a properties file 
(`gravitino.test.endpoints.file`). Selected with 
`gravitino.test.containers=external` or per service. A Kubernetes deployment 
only has to write that file. Operations that need a Docker container (exec, 
restart, logs) fail with a clear message on an external one.
   
   HDFS needs one address that is valid both from the test and from the 
metastore inside the container; `HiveContainer` provides it 
(`withHostReachableHdfs()`).
   
   Plan, in small PRs: (1) accessors and both backings, with two tests 
migrated; (2) migrate the remaining callers by service; (3) HDFS callers; (4) 
remove `getContainerIpAddress()`, the fixed subnet and mac-docker-connector; 
(5) later, a CI lane against an external cluster.
   
   Related: #13900.
   


-- 
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]

Reply via email to