nevzheng opened a new pull request, #14118:
URL: https://github.com/apache/gravitino/pull/14118

   ### What changes were proposed in this pull request?
   
   Tests can ask a container for its addresses instead of building them from 
its Docker IP, and the same container can point at a service running elsewhere. 
This is step 1 of #14117.
   
   - **Accessors on the container:** `HiveContainer.metastoreUri()`, 
`hdfsUri()`, `hdfsConfiguration()`, `KafkaContainer.bootstrapServers()` and the 
JDBC URL on `MySQLContainer`. Managed containers answer with `getHost()` and 
mapped ports, or the official module's own accessors.
   - **External backing:** with `gravitino.test.containers=external` (or 
`gravitino.test.<service>.external=true`), `SharedContainers` builds the 
container without starting it, and its accessors read 
`gravitino.test.<service>.<key>` from a system property, an environment 
variable (`GRAVITINO_TEST_HIVE_METASTORE_URI`) or the properties file named by 
`gravitino.test.endpoints.file`. Docker-only operations (exec, logs, restart) 
fail with a clear message.
   - **HDFS reachable from both sides:** 
`HiveContainer.Builder.withHostReachableHdfs()` gives the container the 
hostname `localhost` and publishes the NameNode and DataNode on the same free 
port inside and outside, so an `hdfs://` address works from the test and from 
the metastore in the container.
   - **Two tests migrated:** `CatalogKafkaIT` and `ProxyCatalogHiveIT`.
   - `ContainerExtension`, Specs, `Fixtures` and the fixture annotations are 
unchanged.
   
   ### Why are the changes needed?
   
   About 97 test files build `ip:port` from the Docker bridge IP. That only 
works where the test JVM can route to Docker's network, which is why macOS 
needs mac-docker-connector and a fixed subnet and allows one test run at a 
time, and it ties every test to containers on local Docker. Testcontainers' own 
mechanism is host plus mapped port; the accessors use it, and the external 
backing lets the same tests run against services deployed elsewhere, such as a 
Kubernetes test cluster, from a file of addresses.
   
   Part of #14117
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. Test code only.
   
   ### How was this patch tested?
   
   - `TestExternalEndpoints` and the container unit tests: 24 pass (parsing, 
precedence, missing-key messages, client settings).
   - `CatalogKafkaIT`: 10/10 managed; 10/10 external against `docker run -p 
9092:9092 apache/kafka:3.7.0` with a properties file.
   - `ProxyCatalogHiveIT`: 3/3 managed with host-reachable HDFS (0/3 with plain 
mapped ports, which motivated it); 3/3 external against a Hive started by hand 
with the addresses in a properties file.
   - The two tests are identical between the managed and external runs.
   
   Based on the #13900 stack (#14094); review the last commit only until the 
stack lands.
   


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