Repository navigation
Conversation
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes.
|
| Layer / File(s) | Summary |
|---|---|
Driver requirement message and guidance modules/jdbc/src/main/java/org/testcontainers/containers/JdbcDatabaseContainer.java, modules/jdbc/src/test/java/org/testcontainers/jdbc/MissingJdbcDriverTest.java, docs/modules/databases/r2dbc.md, docs/modules/databases/mariadb.md, docs/modules/databases/mssqlserver.md, docs/modules/databases/mysql.md |
The missing-driver exception message identifies the driver class and states that startup checks use JDBC, including for R2DBC-only applications. The test checks the message and cause. The database documentation states the driver requirement. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Other
Suggested reviewers: rnorth
Merge Risk: 
Minimal · previous review e56cd
-
The clearer message and documentation should help R2DBC-only users identify the missing JDBC dependency. No concrete merge-blocking risk is established, so the change is mergeable under normal checks.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Description check
-
Explanation
The description is complete. It explains the problem, affected modules, error behavior, implementation changes, documentation updates, scope, related issues, and verification results, including the Docker test limitation.
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. (4 skipped: 4 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
d55249d9-779b-4ae4-8c6b-92f1e487481e
📒 Files selected for processing: 6
-
docs/modules/databases/mariadb.md
docs/modules/databases/mssqlserver.md
docs/modules/databases/mysql.md
docs/modules/databases/r2dbc.md
modules/jdbc/src/main/java/org/testcontainers/containers/JdbcDatabaseContainer.java
modules/jdbc/src/test/java/org/testcontainers/jdbc/MissingJdbcDriverTest.java
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
d55249d9-779b-4ae4-8c6b-92f1e487481e
📒 Files selected for processing: 6
-
docs/modules/databases/mariadb.mddocs/modules/databases/mssqlserver.mddocs/modules/databases/mysql.mddocs/modules/databases/r2dbc.mdmodules/jdbc/src/main/java/org/testcontainers/containers/JdbcDatabaseContainer.javamodules/jdbc/src/test/java/org/testcontainers/jdbc/MissingJdbcDriverTest.java
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
-
MySQLContainer, MariaDBContainer and MSSQLServerContainer use the default JdbcDatabaseContainer startup check, which connects over JDBC. Projects that only use R2DBC therefore still need the JDBC driver on the test classpath, and without it the container fails with a bare "Could not get Driver". - Name the driver class in the NoDriverFoundException message and say why it is needed, also when the application only uses R2DBC - Document the requirement in the R2DBC page and in the MySQL, MariaDB and MS SQL Server module pages - Add a unit test for the message that does not need Docker
e56cdd7 to
141dc8a
Compare
|
Hi @kiview, a short note on this one. The workflow runs for e56cdd7 (CI, CI-Docker-Wormhole, CI-Docker-Rootless) were waiting for approval since Oct 18 and expired on Nov 17, so the PR showed them as failed even though no job ever ran. I rebased onto current main (head is now 141dc8a) to trigger fresh runs, which are now waiting for approval. The change is small: a clearer exception message in JdbcDatabaseContainer when the JDBC driver is missing (a common case in R2DBC-only setups), a test for it, and a note in the R2DBC, MySQL, MariaDB and MS SQL Server docs. Could you approve the workflows when you have a moment? Thanks! |
Problem
MySQLContainer,MariaDBContainerandMSSQLServerContainerdo not overridewaitUntilContainerStarted(), so they use the defaultJdbcDatabaseContainerstartup check, which opens a JDBC connection and runs the test query. A project that only uses R2DBC (testcontainers-r2dbc+r2dbc-mssql, for example) therefore still needs the JDBC driver on the test classpath. Without it, the container fails with:The driver class name only shows up in the
ClassNotFoundExceptioncause, and neitherr2dbc.mdnor the module pages mention that R2DBC users need the JDBC driver.modules/mssqlserver/build.gradlealready notes it internally (// MSSQL's wait strategy requires the JDBC driver), but it does not reach users. Related questions: #4610 / #4611, #9465 (ClickHouse, solved there by changing the wait strategy in #9466).PostgreSQL, Oracle Free and ClickHouse override the startup check, so they are not affected.
Changes
JdbcDatabaseContainer.getJdbcDriverInstance(): theNoDriverFoundExceptionmessage now names the driver class and explains why it is required, also for R2DBC-only applications. The message still starts withCould not get Driver.MissingJdbcDriverTest.shouldNameTheMissingDriverClass: asserts the new message; it callsgetJdbcDriverInstance()directly, so it does not need Docker.r2dbc.mdand one sentence in the existing driver hint ofmysql.md,mariadb.mdandmssqlserver.md.No behavior change; the wait strategy is untouched (changing it for MSSQL looked riskier, and #12080 is moving PostgreSQL in the opposite direction).
Verification
./gradlew :testcontainers-jdbc:test --tests org.testcontainers.jdbc.MissingJdbcDriverTest.shouldNameTheMissingDriverClass: green./gradlew :testcontainers-jdbc:spotlessCheck :testcontainers-jdbc:compileTestJava :testcontainers-r2dbc:compileTestJava: greenshouldFailFastIfNoDriverFoundonly asserts the root cause type, which is unchanged.Summary by CodeRabbit