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

Document known testcontainers lifecycle issues #35236

Open
philwebb opened this issue May 2, 2023 · 6 comments
Open

Document known testcontainers lifecycle issues #35236

philwebb opened this issue May 2, 2023 · 6 comments
Assignees
Labels
type: documentation A documentation update
Milestone

Comments

@philwebb
Copy link
Member

philwebb commented May 2, 2023

See #35223 (comment)

@scottfrederick

This comment was marked as off-topic.

@mhalbritter mhalbritter modified the milestones: 3.1.x, 3.2.x May 23, 2024
@wilkinsona
Copy link
Member

We should also document problems that can be caused by the combination of using @Testcontainers and the test context framework's caching. The former will stop containers in an after all callback, whereas the latter may cache a context that will then be reused later on and will attempt to access a service in an already-stopped container. See #42854 for an example of this problem.

@hscholz
Copy link

hscholz commented Mar 11, 2025

Maybe it would be a good idea to start with the documentation of @ImportTestcontainers? It solves at least the use case of #42854. At least it took me quite some time to find this alternative, which works for my use case quite well.

@wilkinsona
Copy link
Member

It's already documented. What did you have in mind, @hscholz?

@hscholz
Copy link

hscholz commented Mar 11, 2025

I was looking at the testing documentation:Testcontainers There it is not mentioned and I obviously didn't look further since nothing else is mentioned there. And since my use case was about testing I didn't look there. At the very least just a link to it would be great. But I think it would be even clearer, if most of the documentation of the Development-time Services of TestContainers would move to the Testcontainers page and only the part of how to use it for development with the DevTools and the idea to create a TestApplication would belong to the Development-time Services page.

My use case is Integration Testing exactly like in #42854.

@hscholz
Copy link

hscholz commented Mar 11, 2025

Maybe to elaborate on the use-case: Spotify described it quite well here

And one additional benefit of this: it usually replaces starting the application locally since you can easily debug from these tests and it even automates all the steps I might have to prepare to get to the specific scenario, e.g. a specific order of messages arrived or a sequence of REST calls.

And the third topic for me is to test that my use the framework (still) does what I expect. A lot of things are handled by the frameworks used, starting with Spring itself, e.g. Exceptions translated into HTTP error codes, but also things like Spring Data. This gives me quite a lot confidence both for the feature itself as well as for updating my dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation A documentation update
Projects
None yet
Development

No branches or pull requests

5 participants