You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some testing situations, it is okay to spin up docker-compose containers once, keep them running and reuse them for both local development and testing. For instance, if your test setup is configured to clear your data at the start (and end) of each run and / or preload it with specific data.
For Spring Boot itself, we can just add the spring-boot-docker-compose module and configure the its lifecycle to start_only.
When containers in a docker-compose file have been ran previously, a project prefix is assigned to each container, usually the name of the current folder.
When the docker-compose testcontainers module starts the containers, it uses a random project ID. This obviously does not match the project ID when you previously manually (or through Spring Boot) started the containers. This causes a runtime error because it tries to start new containers, but the ports are already allocated.
It would be nice if the docker-compose module allowed containers to be reused between development and testing and have some lifecycle options such as 'start only' which would work well for iterative local development.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
In some testing situations, it is okay to spin up docker-compose containers once, keep them running and reuse them for both local development and testing. For instance, if your test setup is configured to clear your data at the start (and end) of each run and / or preload it with specific data.
For Spring Boot itself, we can just add the
spring-boot-docker-compose
module and configure the its lifecycle tostart_only
.When containers in a docker-compose file have been ran previously, a project prefix is assigned to each container, usually the name of the current folder.
When the docker-compose testcontainers module starts the containers, it uses a random project ID. This obviously does not match the project ID when you previously manually (or through Spring Boot) started the containers. This causes a runtime error because it tries to start new containers, but the ports are already allocated.
It would be nice if the docker-compose module allowed containers to be reused between development and testing and have some lifecycle options such as 'start only' which would work well for iterative local development.
Beta Was this translation helpful? Give feedback.
All reactions