testcontainers / testcontainers-java

Testcontainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.
https://testcontainers.org
MIT License
8.05k stars 1.66k forks source link

[Enhancement]: Provide a way to override the JDBC URL parameters used to test whether a database is up #9503

Open Yaytay opened 2 weeks ago

Yaytay commented 2 weeks ago

Module

MySQL

Proposal

The latest versions of the MySQL JDBC driver are able to make use of OpenTelemetry. Unfortunately the combination of design decisions by OpenTelemetry, MySQL and TestContainers means that if a MySQL TestContainer is started first (in a static, for example) and then the code under test tries to configure OpenTelemetry it will fail because the MySQL driver has already configured OpenTelemetry - it does so when it use by OpenTelemetry for testing whether the database is up. The MySQL and OpenTelemetry behaviour is reasonable for production deployments, but irritating for tests.

If TestContainers provided a way to set (or modify) the URL used to connect to MySQL this irritation could be avoided (I could tack on the openTelemetry=DISABLED argument).