You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Client: Docker Engine - Community
Version: 25.0.1
API version: 1.43 (downgraded from 1.44)
Go version: go1.21.6
Git commit: 29cf629222
Built: Tue Jan 23 15:11:10 2024
OS/Arch: darwin/arm64
Context: default
Server: Docker Engine - Community
Engine:
Version: 24.0.7
API version: 1.43 (minimum version 1.12)
Go version: go1.20.10
Git commit: 311b9ff
Built: Thu Oct 26 09:07:58 2023
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.25
GitCommit: d8f198a4ed8892c764191ef7b3b06d8a2eeb5c7f
runc:
Version: 1.1.10
GitCommit: v1.1.10-0-g18a0cb0
docker-init:
Version: 0.19.0
GitCommit: de40ad0
What happened?
When using a host-less jdbc string as jdbc:tc:mysql:8.0.36:///my_database?useConfigs=maxPerformance&characterEncoding=utf8&useSSL=false as suggested in the examples [1], the database name is not correctly extracted and it defaults to test. Adding any random host:port allows the database name to be extracted correctly (e.g. jdbc:tc:mysql:8.0.36://foobar:42424242/my_database )
The regex that extracts the database name does not support host-less jdbc urls "([^:]+)(:([0-9]+))?/([^\\\\?]+) as it tries to extract it from the dbHostString field that in case of a host-less jdbc string is /database_name.
Module
Core
Testcontainers version
1.19.5
Using the latest Testcontainers version?
Yes
Host OS
OsX
Host Arch
ARM
Docker version
Client: Docker Engine - Community Version: 25.0.1 API version: 1.43 (downgraded from 1.44) Go version: go1.21.6 Git commit: 29cf629222 Built: Tue Jan 23 15:11:10 2024 OS/Arch: darwin/arm64 Context: default Server: Docker Engine - Community Engine: Version: 24.0.7 API version: 1.43 (minimum version 1.12) Go version: go1.20.10 Git commit: 311b9ff Built: Thu Oct 26 09:07:58 2023 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.25 GitCommit: d8f198a4ed8892c764191ef7b3b06d8a2eeb5c7f runc: Version: 1.1.10 GitCommit: v1.1.10-0-g18a0cb0 docker-init: Version: 0.19.0 GitCommit: de40ad0
What happened?
When using a host-less jdbc string as
jdbc:tc:mysql:8.0.36:///my_database?useConfigs=maxPerformance&characterEncoding=utf8&useSSL=false
as suggested in the examples [1], the database name is not correctly extracted and it defaults totest
. Adding any randomhost:port
allows the database name to be extracted correctly (e.g.jdbc:tc:mysql:8.0.36://foobar:42424242/my_database
)The regex that extracts the database name does not support host-less jdbc urls
"([^:]+)(:([0-9]+))?/([^\\\\?]+)
as it tries to extract it from thedbHostString
field that in case of a host-less jdbc string is/database_name
.[1] https://java.testcontainers.org/modules/databases/jdbc/#:~:text=We%20will%20use%20///%20(host%2Dless%20URIs)%20from%20now%20on%20to%20emphasis%20the%20unimportance%20of%20the%20host%3Aport%20pair.%0AFrom%20Testcontainers%27%20perspective%2C%20jdbc%3Amysql%3A8.0.36%3A//localhost%3A3306/databasename%20and%20jdbc%3Amysql%3A8.0.36%3A///databasename%20is%20the%20same%20URI.
Relevant log output
No response
Additional Information
https://regex101.com/r/na4SoN/1 (check test cases)
The text was updated successfully, but these errors were encountered: