Problem :
Right now, while using the Spring Boot Docker compose feature during my tests writings, I sometime forcefully stop them, either from command line or Intellij IDE
In such a case :
- this feature don't have the time to apply the stop step asked with spring.docker.compose.lifecycle-management=start_and_stop
- the container stay there, hanging around in a transient state
If I forget to cleanup those remaining containers myself, they'll be reused during my next test campagne startup, which can lead to tests failing, reporting false negative.
Fair enough, I agree that it's because I'm only human, and sometime forget to apply a mocked DB content cleanup step before each of my tests, which is bad (really really bad I mean 😉)
Proposed solution :
I think it would be great to add an extra restart option for spring.docker.compose.start.command property
That way, I'd be certain that my mocked environment has been restarted from scratch, and the DB initialization scripts that are used in the Docker compose file are replayed each time
I'm fine paying this extra restart time if it avoid me thinking one of my colleagues pushed flacky or failing tests on main whereas the trouble is simply what I have described above 🤦
Comment From: philwebb
Another option might be to add an option to spring.docker.compose.lifecycle-management or tweak start-and-stop.