nevzheng commented on issue #13900: URL: https://github.com/apache/gravitino/issues/13900#issuecomment-6272559666
Findings and a direction from looking at the MySQL and PostgreSQL test containers while working on #13899. **Today** - The same databases start two ways. `ContainerSuite` builds `MySQLContainer`/`PostgreSQLContainer` on `BaseContainer`, which wraps a plain `GenericContainer` (28 test files in 12 modules). Seven other test files use Testcontainers' own `MySQLContainer`/`PostgreSQLContainer` directly. - The `BaseContainer` versions reimplement what the Testcontainers modules already do: credentials, readiness polling (the MySQL check returns success after 10 s even if the server never answered), and JDBC driver loading. - Testcontainers 1.x copies a small `my.cnf` (16 MB InnoDB buffer pool) into every MySQL module container unless a test overrides it. - `BaseContainer` is not a `Startable`, so it cannot be used with `Startables.deepStart` or `@Container`. **Direction** 1. Build database containers on the Testcontainers modules and add only what they lack: the network alias, the in-network JDBC URL used by the Trino, Spark and Flink containers, database creation on a shared server, and log output. Wrap the module rather than subclass it, since the module's own `getJdbcUrl()` is host-side and its readiness check depends on it. 2. Keep server settings in configuration we own (a MySQL config file, PostgreSQL command options) rather than the module defaults, so a Testcontainers upgrade does not change server behaviour. 3. Treat durability as a setting of the container (`DEFAULT` or `DISPOSABLE`), chosen once by the test task. Disposable data goes on `tmpfs` with commit syncing off, which the Testcontainers and PostgreSQL docs both recommend for tests. 4. Log the settings each database reports at startup, so every run's output shows which mode it ran in. 5. Make `BaseContainer` a `Startable`. #13899 does this for MySQL and PostgreSQL. #13958 covers the Testcontainers 2.x upgrade. The other containers and the seven direct users can follow the same pattern. -- 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]
