Repository navigation
Conversation
…put (testcontainers#12151) Signed-off-by: Inf1mum <vadim.lazuk@mail.ru>
Author
|
Hi! These are my first PRs to this repo, so the CI workflows (CI, CI-Docker-Rootless, CI-Docker-Wormhole) have been sitting in "Awaiting approval" ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 #12151
What has changed?
LogMessageWaitStrategynow aborts the wait as soon aswaitStrategyTargetis no longer running, instead of waiting the whole startup timeout when the container exits before producing the expected log output.The existing
WaitingConsumer.waitUntil(...)call is unchanged (same startup timeout, sametimessemantics) and runs on the sharedAbstractWaitStrategy.EXECUTOR, while the calling thread polls the target with the same AwaitilityfailFastpattern thatHostPortWaitStrategyalready relies on:When the container exits before a match, the wait fails with
Container stopped before the expected log output matching '<regEx>' was produced. A short (~1s) grace period lets output buffered right before the exit still match, so a container that prints the expected message and then exits keeps succeeding. DetectingOutputFrame.ENDin the wait predicate was considered but rejected: frames are polled from the buffer newest-first (pollLastinWaitingConsumer), soENDcan be examined before earlier buffered frames and would false-fail that case. Timeout semantics for a still-running container are unchanged (Timed out waiting for log output ...).For the repro from the issue (alpine printing
started, thenexit 1after ~2s, waiting for.*never.*with a 60s startup timeout),start()now fails in ~3s instead of ~62s.Testing
Added
LogMessageWaitStrategyTest(real containers, likeDockerHealthcheckWaitStrategyTest):shouldFailFastWhenContainerExitsBeforeExpectedLogOutput— the issue repro; asserts launch fails with the new message well under the startup timeout (measured ~3s vs the 60s timeout).shouldStillTimeOutWhenContainerKeepsRunningWithoutExpectedLogOutput— timeout semantics for a still-running container are unchanged.shouldSucceedWhenExpectedLogOutputAppearsWhileContainerIsRunning— the regular match path still works.Ran locally with Docker available (
docker inforeports 29.7.2): all three tests pass, plus the existingorg.testcontainers.containers.wait.strategy.*andorg.testcontainers.containers.output.*tests. Formatting via./gradlew spotlessApply.