Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reuse database container #17

Open
Barsonax opened this issue Dec 1, 2023 · 1 comment · Fixed by #28
Open

Reuse database container #17

Barsonax opened this issue Dec 1, 2023 · 1 comment · Fixed by #28
Labels
enhancement New feature or request

Comments

@Barsonax
Copy link
Owner

Barsonax commented Dec 1, 2023

Currently the startup time of the database container dominates the total run time when running a few or a single test. Reusing the container instance would largely solve this.

At the moment of writing this Testcontainers .NET does not support this yet but works seems to be underway to change this: testcontainers/testcontainers-dotnet#1051

When this is supported switch over to reusing the container instance.

@Barsonax Barsonax added the enhancement New feature or request label Dec 9, 2023
@Barsonax Barsonax linked a pull request Apr 5, 2024 that will close this issue
@Barsonax
Copy link
Owner Author

Barsonax commented Apr 10, 2024

Some preparations were done namely generating stable names per run of the tests. A hash of the script that is used to create the database is used in the name of the database. This allows future runs to reuse that same database without having to recreate it from scratch saving time. With this the first test you run can finish in under a second instead of several seconds.

However I ran into some issues with the testcontainer container reuse feature itself. When running multiple test assemblies at the same time for instance multiple containers were created. When you try to run tests again testcontainers would crash and the only way to fix this is to manually stop the containers. For this reason I didnt enabled container reuse by default yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant