-
-
Notifications
You must be signed in to change notification settings - Fork 492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected behavior for WaitLog.WithOccurence #297
Comments
@FlorianLehmann should we close this issue? I see the PR was merged Thanks!! |
Yes, this has been resolved. It can be closed. Thanks |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
func TestWaitShouldFailWithExactNumberOfOccurrences(t *testing.T) { target := noopStrategyTarget{ ioReaderCloser: ioutil.NopCloser(bytes.NewReader([]byte("hello\r\ndude"))), } wg := NewLogStrategy("dude"). WithStartupTimeout(100 * time.Microsecond). WithOccurrence(2) err := wg.WaitUntilReady(context.Background(), target) if err == nil { t.Fatal("expected error") } }
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.
The text was updated successfully, but these errors were encountered: