[Feature]: Support a reuseWindow
for cleaning up reusable containers if no tests run within a certain duration
#2804
Labels
feature
New functionality or new behaviors on the existing one
Problem
I run tests that require a mysql. While I'm iterating on my tests, I'd like to leverage
reuse
to only pay that boot price on the first test, and then subsequent tests can reuse the same mysql (which is close to a 6x improvement in speed).However, I also want the reaper to clean up this container once I'm done with my testing "session", so I don't have a mysql running that I forgot to manually clean up.
I'm imagining a config like
reuse: true, reuseTimeout: 5m
. Which makes it so as long as I run a test within 5m of the last test, the reaper leaves the mysql container alone, but once 5m elapses without triggering a test, the reaper cleans everything up.I thought this might be possible today with a combination of
reuse: true
andTESTCONTAINERS_RYUK_RECONNECTION_TIMEOUT=5m
, but that still cleans up my mysql after 5m from the first test (and also spawns a new reaper for every run, which quickly pile up):Solution
Add a rolling reaper cleanup window
Benefit
Users can reuse containers, but not have to worry about manually cleaning them up
Alternatives
Manually delete reusable containers
Would you like to help contributing this feature?
Yes
The text was updated successfully, but these errors were encountered: