0

I usually run my spring-boot-test junit sql tests on a Testcontainers setup like this:

spring.datasource.url=jdbc:tc:mariadb:10.5.8:///test
spring.datasource.username=test
spring.datasource.password=test

Question: when I omit the docker image value, like spring.datasource.url=jdbc:tc:mariadb:///test, how can I force to always use a fixed docker image version?

My goal is to provide a test-commons.jar that every project should include. So projects should all use the same default mariadb image defined in the commons jar, and not set the image explicit themselves.

Is that possible?

2
  • I have only heard about testcontainers, but spring.datasource.url is just a spring property and there are many ways to configure that; but I might be missing something here Commented Feb 9, 2021 at 18:20
  • @Eugene that's Testcontainers JDBC URL support. Commented Feb 10, 2021 at 8:57

1 Answer 1

1

You can copy MariaDBContainerProvider, use "mymariadb" or "custommariadb" as the database type and set the desired version in newInstance().

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.