Fix/wait log exact number occurences #298
Merged
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.
#297
Describe the bug
When I define
NewLogStrategy("").
WithStartupTimeout(100 * time.Microsecond).
WithOccurrence(X)
for a container, it does not wait for X occurences. One occurence is enough to continue.
To Reproduce
Expected behavior
it must wait for X occurences in the logs.
Additional context
testcontainers-go/wait/log.go
Lines 75 to 95 in 6467d9b
There is a variable currentOccurence defined before the loop. This variable is incremented in the loop each time the expected log appears. However, logs are read from the beginning. Therefore, the condition based on the number of occurences is always true if the expected log is present only once.