Abort timers when log wait strategy completes #983
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #982
To reproduce this we need to run the reaper container which invokes
Wait.forLogMessage(). This MUST be done in vitest'sglobalSetup. UnlikesetupFilesor in an individual test, vitest will wait for all processes to complete before shutting down.The issue is introduced here: https://github.com/testcontainers/testcontainers-node/pull/977/files#diff-586d44bcd7d69ec116da37a953ccb21b6d22a17c3977e1b98eb487870b899007R20
The
setTimeoutruns in the background even after the reaper container has started, preventing the process from exiting. This PR incorporates abort signals between thesetTimeoutand the resolution of the log message, to ensure that when one succeeds, the other is aborted.Struggling to add a test for this.
Tempted to simply revert the commit instead of try to fix forward, in case more issues are introduced: #984