Speed up testcontainers intialization time #11844
sviatoslav1989
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone! I built a small Java library that sits on top of Testcontainers and speeds up integration tests when container startup is the bottleneck.
preinit-testcontainers runs your init (SQL scripts, migrations, custom callbacks) once, commits a local Docker image, and reuses it on every start(). Combined with tmpfs snapshot/restore, repeat starts are much faster - e.g. MySQL with 100 tables went from ~13.6s to ~1.4s on my machine.
Modules: MySQL, PostgreSQL, ClickHouse, Redis, plus a generic core for other images. Testcontainers 1.x, 2.x, Java 8+, on Maven Central.
GitHub: https://github.com/sviatoslav1989/preinit-testcontainers
Article (tmpfs + pre-init, with benchmarks): https://sviat-tech.com/integration-tests-java-testcontainers-tmpfs-preinit/
Would love feedback if you try it
Beta Was this translation helpful? Give feedback.
All reactions