Skip to content

Commit

Permalink
chore: increase timeout values
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 committed Aug 8, 2024
1 parent 150a48c commit 046a3de
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
9 changes: 9 additions & 0 deletions docker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,15 @@ func TestContainerReturnItsContainerID(t *testing.T) {
func TestContainerTerminationResetsState(t *testing.T) {
ctx := context.Background()

<<<<<<< HEAD

Check failure on line 249 in docker_test.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest) / ./ubuntu-latest/1.21.x

syntax error: unexpected <<, expected }

Check failure on line 249 in docker_test.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest) / ./ubuntu-latest/1.21.x

expected statement, found '<<' (typecheck)

Check failure on line 249 in docker_test.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest) / ./ubuntu-latest/1.21.x

syntax error: unexpected <<, expected }

Check failure on line 249 in docker_test.go

View workflow job for this annotation

GitHub Actions / test (1.x, ubuntu-latest) / ./ubuntu-latest/1.x

syntax error: unexpected <<, expected }

Check failure on line 249 in docker_test.go

View workflow job for this annotation

GitHub Actions / test (1.x, ubuntu-latest) / ./ubuntu-latest/1.x

expected statement, found '<<' (typecheck)

Check failure on line 249 in docker_test.go

View workflow job for this annotation

GitHub Actions / test (1.x, ubuntu-latest) / ./ubuntu-latest/1.x

syntax error: unexpected <<, expected }

Check failure on line 249 in docker_test.go

View workflow job for this annotation

GitHub Actions / Test with reaper off (1.21.x) / ./ubuntu-latest/1.21.x

syntax error: unexpected <<, expected }

Check failure on line 249 in docker_test.go

View workflow job for this annotation

GitHub Actions / Test with reaper off (1.21.x) / ./ubuntu-latest/1.21.x

expected statement, found '<<' (typecheck)

Check failure on line 249 in docker_test.go

View workflow job for this annotation

GitHub Actions / Test with reaper off (1.21.x) / ./ubuntu-latest/1.21.x

syntax error: unexpected <<, expected }

Check failure on line 249 in docker_test.go

View workflow job for this annotation

GitHub Actions / Test with reaper off (1.x) / ./ubuntu-latest/1.x

syntax error: unexpected <<, expected }

Check failure on line 249 in docker_test.go

View workflow job for this annotation

GitHub Actions / Test with reaper off (1.x) / ./ubuntu-latest/1.x

expected statement, found '<<' (typecheck)

Check failure on line 249 in docker_test.go

View workflow job for this annotation

GitHub Actions / Test with reaper off (1.x) / ./ubuntu-latest/1.x

syntax error: unexpected <<, expected }

Check failure on line 249 in docker_test.go

View workflow job for this annotation

GitHub Actions / Test with Rootless Docker (1.21.x, ubuntu-latest) / ./ubuntu-latest/1.21.x

syntax error: unexpected <<, expected }

Check failure on line 249 in docker_test.go

View workflow job for this annotation

GitHub Actions / Test with Rootless Docker (1.21.x, ubuntu-latest) / ./ubuntu-latest/1.21.x

expected statement, found '<<' (typecheck)

Check failure on line 249 in docker_test.go

View workflow job for this annotation

GitHub Actions / Test with Rootless Docker (1.21.x, ubuntu-latest) / ./ubuntu-latest/1.21.x

syntax error: unexpected <<, expected }

Check failure on line 249 in docker_test.go

View workflow job for this annotation

GitHub Actions / Test with Rootless Docker (1.x, ubuntu-latest) / ./ubuntu-latest/1.x

syntax error: unexpected <<, expected }

Check failure on line 249 in docker_test.go

View workflow job for this annotation

GitHub Actions / Test with Rootless Docker (1.x, ubuntu-latest) / ./ubuntu-latest/1.x

expected statement, found '<<' (typecheck)

Check failure on line 249 in docker_test.go

View workflow job for this annotation

GitHub Actions / Test with Rootless Docker (1.x, ubuntu-latest) / ./ubuntu-latest/1.x

syntax error: unexpected <<, expected }
=======
oldDebugPrintln := debugPrintln
debugPrintln = t.Log
t.Cleanup(func() {

Check failure on line 253 in docker_test.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest) / ./ubuntu-latest/1.21.x

method has no receiver

Check failure on line 253 in docker_test.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest) / ./ubuntu-latest/1.21.x

syntax error: unexpected {, expected name

Check failure on line 253 in docker_test.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest) / ./ubuntu-latest/1.21.x

method has no receiver

Check failure on line 253 in docker_test.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest) / ./ubuntu-latest/1.21.x

syntax error: unexpected {, expected name

Check failure on line 253 in docker_test.go

View workflow job for this annotation

GitHub Actions / test (1.x, ubuntu-latest) / ./ubuntu-latest/1.x

method has no receiver

Check failure on line 253 in docker_test.go

View workflow job for this annotation

GitHub Actions / test (1.x, ubuntu-latest) / ./ubuntu-latest/1.x

syntax error: unexpected {, expected name

Check failure on line 253 in docker_test.go

View workflow job for this annotation

GitHub Actions / test (1.x, ubuntu-latest) / ./ubuntu-latest/1.x

method has no receiver

Check failure on line 253 in docker_test.go

View workflow job for this annotation

GitHub Actions / test (1.x, ubuntu-latest) / ./ubuntu-latest/1.x

syntax error: unexpected {, expected name

Check failure on line 253 in docker_test.go

View workflow job for this annotation

GitHub Actions / Test with reaper off (1.21.x) / ./ubuntu-latest/1.21.x

method has no receiver

Check failure on line 253 in docker_test.go

View workflow job for this annotation

GitHub Actions / Test with reaper off (1.21.x) / ./ubuntu-latest/1.21.x

syntax error: unexpected {, expected name

Check failure on line 253 in docker_test.go

View workflow job for this annotation

GitHub Actions / Test with reaper off (1.21.x) / ./ubuntu-latest/1.21.x

method has no receiver

Check failure on line 253 in docker_test.go

View workflow job for this annotation

GitHub Actions / Test with reaper off (1.21.x) / ./ubuntu-latest/1.21.x

syntax error: unexpected {, expected name

Check failure on line 253 in docker_test.go

View workflow job for this annotation

GitHub Actions / Test with reaper off (1.x) / ./ubuntu-latest/1.x

method has no receiver

Check failure on line 253 in docker_test.go

View workflow job for this annotation

GitHub Actions / Test with reaper off (1.x) / ./ubuntu-latest/1.x

syntax error: unexpected {, expected name

Check failure on line 253 in docker_test.go

View workflow job for this annotation

GitHub Actions / Test with reaper off (1.x) / ./ubuntu-latest/1.x

method has no receiver

Check failure on line 253 in docker_test.go

View workflow job for this annotation

GitHub Actions / Test with reaper off (1.x) / ./ubuntu-latest/1.x

syntax error: unexpected {, expected name

Check failure on line 253 in docker_test.go

View workflow job for this annotation

GitHub Actions / Test with Rootless Docker (1.21.x, ubuntu-latest) / ./ubuntu-latest/1.21.x

method has no receiver

Check failure on line 253 in docker_test.go

View workflow job for this annotation

GitHub Actions / Test with Rootless Docker (1.21.x, ubuntu-latest) / ./ubuntu-latest/1.21.x

syntax error: unexpected {, expected name

Check failure on line 253 in docker_test.go

View workflow job for this annotation

GitHub Actions / Test with Rootless Docker (1.21.x, ubuntu-latest) / ./ubuntu-latest/1.21.x

method has no receiver

Check failure on line 253 in docker_test.go

View workflow job for this annotation

GitHub Actions / Test with Rootless Docker (1.21.x, ubuntu-latest) / ./ubuntu-latest/1.21.x

syntax error: unexpected {, expected name

Check failure on line 253 in docker_test.go

View workflow job for this annotation

GitHub Actions / Test with Rootless Docker (1.x, ubuntu-latest) / ./ubuntu-latest/1.x

method has no receiver

Check failure on line 253 in docker_test.go

View workflow job for this annotation

GitHub Actions / Test with Rootless Docker (1.x, ubuntu-latest) / ./ubuntu-latest/1.x

syntax error: unexpected {, expected name

Check failure on line 253 in docker_test.go

View workflow job for this annotation

GitHub Actions / Test with Rootless Docker (1.x, ubuntu-latest) / ./ubuntu-latest/1.x

method has no receiver

Check failure on line 253 in docker_test.go

View workflow job for this annotation

GitHub Actions / Test with Rootless Docker (1.x, ubuntu-latest) / ./ubuntu-latest/1.x

syntax error: unexpected {, expected name
debugPrintln = oldDebugPrintln
})

Check failure on line 255 in docker_test.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest) / ./ubuntu-latest/1.21.x

syntax error: unexpected ) after top level declaration (typecheck)

Check failure on line 255 in docker_test.go

View workflow job for this annotation

GitHub Actions / test (1.x, ubuntu-latest) / ./ubuntu-latest/1.x

syntax error: unexpected ) after top level declaration (typecheck)

Check failure on line 255 in docker_test.go

View workflow job for this annotation

GitHub Actions / Test with reaper off (1.21.x) / ./ubuntu-latest/1.21.x

syntax error: unexpected ) after top level declaration (typecheck)

Check failure on line 255 in docker_test.go

View workflow job for this annotation

GitHub Actions / Test with reaper off (1.x) / ./ubuntu-latest/1.x

syntax error: unexpected ) after top level declaration (typecheck)

Check failure on line 255 in docker_test.go

View workflow job for this annotation

GitHub Actions / Test with Rootless Docker (1.21.x, ubuntu-latest) / ./ubuntu-latest/1.21.x

syntax error: unexpected ) after top level declaration (typecheck)

Check failure on line 255 in docker_test.go

View workflow job for this annotation

GitHub Actions / Test with Rootless Docker (1.x, ubuntu-latest) / ./ubuntu-latest/1.x

syntax error: unexpected ) after top level declaration (typecheck)

>>>>>>> c47b4abb (chore: increase timeout values)
nginxA, err := GenericContainer(ctx, GenericContainerRequest{
ProviderType: providerType,
ContainerRequest: ContainerRequest{
Expand Down
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 046a3de

Please sign in to comment.