Best Tutorial I found, thanks! You should consider writing one up in a blog or something as I didnt find a solution as clean as yours, baeldung etc. does it differently
We created the PostgreSQl DB in a containter. But how the book table already exists in that database? i have not seen any configuration to create the table.
Hi Dasari, thanks for reaching out. It seems I forgot to mention that the Spring Boot application uses Flyway to migrate the database schema on application startup: github.com/rieckpil/blog-tutorials/tree/master/testcontainers-youtube-series/src/main/resources/db/migration
4 года назад+2
Thanks! I did finally despite the others with yours
All good and well, but how did the schema get created in the test container? Didn't it just pull a new container with a random port? How did the schema get created there?
To create the actual tables I'm using Flyway and execute SQL migration scripts during application startup. If you want to e.g. create additional databases or database schemas (instead of using the default public), you can e.g. use Testcontainers .execInContainer() during @BeforeAll or use a custom Docker image where you tweak your database config.
A MongoDB video with Testcontainers might come in the future. I've already covered it with a blog post that explains the setup for a Spring Boot application: rieckpil.de/mongodb-testcontainers-setup-for-datamongotest/
You need to expose the Docker socket (in case your Jenkins agent runs also runs as a Docker container) or install the Docker engine on your build agent. You can find further help here: www.testcontainers.org/supported_docker_environment/continuous_integration/dind_patterns/
great short intro. thanks!
The best video about TestContainers.
Thanks, Allan!
Best Tutorial I found, thanks!
You should consider writing one up in a blog or something as I didnt find a solution as clean as yours, baeldung etc. does it differently
Thanks a lot Andreas!
I have some similar Testcontainers and testing-related articles on my blog already: rieckpil.de/?s=testcontainers
Thanks, great explanation !
Absolutely the best, thanks for the tutorial
Thanks, great job!
Damn! Thanks a lot!Wish you were healthy! Such simple, short and fulfil of information video! Please, do them more!
thank you very much for your feedback :)
great tutorial
Thanks for the feedback. You're welcome 🥳
We created the PostgreSQl DB in a containter. But how the book table already exists in that database? i have not seen any configuration to create the table.
Hi Dasari,
thanks for reaching out. It seems I forgot to mention that the Spring Boot application uses Flyway to migrate the database schema on application startup: github.com/rieckpil/blog-tutorials/tree/master/testcontainers-youtube-series/src/main/resources/db/migration
Thanks! I did finally despite the others with yours
glad to hear that you could successfully use Testcontainers
Thank you much for the tutorial, it was really helpful.
On a side note, could you share which font you are using for Intellij code? Thanks again,
Thanks :) That's JetBrains Mono
Does it take a lot of time to spin up the postgres docker container in application and memory
If you have a decent laptop/PC, not really.
All good and well, but how did the schema get created in the test container? Didn't it just pull a new container with a random port? How did the schema get created there?
To create the actual tables I'm using Flyway and execute SQL migration scripts during application startup. If you want to e.g. create additional databases or database schemas (instead of using the default public), you can e.g. use Testcontainers .execInContainer() during @BeforeAll or use a custom Docker image where you tweak your database config.
Thanks, awesome!!!!!!
Could you please do this tutorial with MongoDB. Nobody did that in RUclips yet. Thx
A MongoDB video with Testcontainers might come in the future. I've already covered it with a blog post that explains the setup for a Spring Boot application: rieckpil.de/mongodb-testcontainers-setup-for-datamongotest/
How do we mix testcontainers, mysql & flyway?
Hi Hendi, please see my answer on your GitHub Issue github.com/rieckpil/blog-tutorials/issues/113
Do you need upfront a running docker.
You only need a running Docker Engine, Testcontainers will start and stop the containers for you.
How to run it in jenkins pipeline?
You need to expose the Docker socket (in case your Jenkins agent runs also runs as a Docker container) or install the Docker engine on your build agent. You can find further help here: www.testcontainers.org/supported_docker_environment/continuous_integration/dind_patterns/
nice
Ehre
Don't forget to change your timezone from 'Europe/Kyiv' to something else, such as Helsinki. It doesn't know anything about Kyiv.