Closed knutwannheden closed 3 years ago
I don't know if it would make sense to parse the JDBC URL config property for the datasource and extract the URL parameters from that or whether there should be another dedicated DevServices config property for this. I am thinking it might be nice if the URL parameters would be extracted by default and could be overridden if necessary.
/cc @stuartwdouglas
@gsmet maybe "DevServices" should trigger some labels, e.g. area/devmode
and area/testing
?
There needs to be a dedicated property for this, if devservices is in use then there is no URL to parse (as the presence of a URL will stop devservices starting)
There needs to be a dedicated property for this, if devservices is in use then there is no URL to parse (as the presence of a URL will stop devservices starting)
I see. I hadn't quite understood yet that this is how devservices is activated. Thanks for the clarification.
As commented on the PR, I believe the implementation for MSSQL needs some minor adjustment.
Description The DevServices feature currently doesn't yet support setting additional URL parameters for the created database. Some database (like Oracle and MySQL for example) allow specifying various parameters (e.g. time zone) as JDBC URL parameters. Currently the JDBC URL will be constructed by Testcontainers, so to specify URL parameters the Dev Service would have to call
org.testcontainers.containers.JdbcDatabaseContainer#withUrlParam()
.Currently
DevServicesDatasourceProvider#startDatabase()
declares a parameterMap<String, String> additionalProperties
. I am however not quite sure about the intended purpose of this parameter. While Testcontainers currently doesn't support specifying parameters (which would be passed tojava.sql.Driver#connect(String, Properties)
), this isn't really necessary either, because Dev Services doesn't delegate the Connection creation to Testcontainers, only the JDBC URL creation.Implementation ideas Possibly the
Map<String, String> additionalProperties
parameter could be (renamed and) repurposed. Or if I have misunderstood its purpose, possibly a new parameter could be introduced which would allow specifying additional JDBC URL parameters.