Skip to content

Commit

Permalink
chore: increase timeout values (#2719)
Browse files Browse the repository at this point in the history
Increase timeout values from microseconds to milliseconds as the former
can lead to failures depending on hardware.
  • Loading branch information
stevenh authored Aug 12, 2024
1 parent 3bc7217 commit bbd4d2c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion logconsumer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ func TestContainerLogWithErrClosed(t *testing.T) {
if errors.Is(err, context.DeadlineExceeded) {
break
}
time.Sleep(100 * time.Microsecond)
time.Sleep(10 * time.Millisecond)
t.Log("retrying get endpoint")
}
if err != nil {
Expand Down
12 changes: 6 additions & 6 deletions wait/log_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestWaitForLog(t *testing.T) {
target := NopStrategyTarget{
ReaderCloser: io.NopCloser(bytes.NewReader([]byte("docker"))),
}
wg := NewLogStrategy("docker").WithStartupTimeout(100 * time.Microsecond)
wg := NewLogStrategy("docker").WithStartupTimeout(100 * time.Millisecond)
err := wg.WaitUntilReady(context.Background(), target)
if err != nil {
t.Fatal(err)
Expand All @@ -39,7 +39,7 @@ func TestWaitForLog(t *testing.T) {
}

// get all words that start with "ip", end with "m" and has a whitespace before the "ip"
wg := NewLogStrategy(`\sip[\w]+m`).WithStartupTimeout(100 * time.Microsecond).AsRegexp()
wg := NewLogStrategy(`\sip[\w]+m`).WithStartupTimeout(100 * time.Millisecond).AsRegexp()
err := wg.WaitUntilReady(context.Background(), target)
if err != nil {
t.Fatal(err)
Expand All @@ -53,7 +53,7 @@ func TestWaitWithExactNumberOfOccurrences(t *testing.T) {
ReaderCloser: io.NopCloser(bytes.NewReader([]byte("kubernetes\r\ndocker\n\rdocker"))),
}
wg := NewLogStrategy("docker").
WithStartupTimeout(100 * time.Microsecond).
WithStartupTimeout(100 * time.Millisecond).
WithOccurrence(2)
err := wg.WaitUntilReady(context.Background(), target)
if err != nil {
Expand All @@ -69,7 +69,7 @@ func TestWaitWithExactNumberOfOccurrences(t *testing.T) {
// get texts from "ip" to the next "m".
// there are three occurrences of this pattern in the string:
// one "ipsum mauris" and two "ipsum dolor sit am"
wg := NewLogStrategy(`ip(.*)m`).WithStartupTimeout(100 * time.Microsecond).AsRegexp().WithOccurrence(3)
wg := NewLogStrategy(`ip(.*)m`).WithStartupTimeout(100 * time.Millisecond).AsRegexp().WithOccurrence(3)
err := wg.WaitUntilReady(context.Background(), target)
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -98,7 +98,7 @@ func TestWaitWithExactNumberOfOccurrencesButItWillNeverHappen(t *testing.T) {

// get texts from "ip" to the next "m".
// there are only three occurrences matching
wg := NewLogStrategy(`do(.*)ck.+`).WithStartupTimeout(100 * time.Microsecond).AsRegexp().WithOccurrence(4)
wg := NewLogStrategy(`do(.*)ck.+`).WithStartupTimeout(100 * time.Millisecond).AsRegexp().WithOccurrence(4)
err := wg.WaitUntilReady(context.Background(), target)
if err == nil {
t.Fatal("expected error")
Expand Down Expand Up @@ -127,7 +127,7 @@ func TestWaitShouldFailWithExactNumberOfOccurrences(t *testing.T) {

// get "Maecenas".
// there are only one occurrence matching
wg := NewLogStrategy(`^Mae[\w]?enas\s`).WithStartupTimeout(100 * time.Microsecond).AsRegexp().WithOccurrence(2)
wg := NewLogStrategy(`^Mae[\w]?enas\s`).WithStartupTimeout(100 * time.Millisecond).AsRegexp().WithOccurrence(2)
err := wg.WaitUntilReady(context.Background(), target)
if err == nil {
t.Fatal("expected error")
Expand Down

0 comments on commit bbd4d2c

Please sign in to comment.