Skip to content

Commit

Permalink
Print container logs on failed TCP conn
Browse files Browse the repository at this point in the history
Signed-off-by: joshvanl <[email protected]>
  • Loading branch information
JoshVanL committed Jul 18, 2024
1 parent 3bbaa68 commit 5679fb4
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions tests/e2e/standalone/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ package standalone_test

import (
"context"
"fmt"
"io"
"net"
"os"
"path/filepath"
Expand Down Expand Up @@ -415,12 +417,24 @@ func verifyTCPLocalhost(t *testing.T, name string, port int) {
t.Helper()

// Check that the server is up and can accept connections.
endpoint := name + ":" + strconv.Itoa(port)
assert.EventuallyWithT(t, func(c *assert.CollectT) {
endpoint := "127.0.0.1:" + strconv.Itoa(port)
if !assert.EventuallyWithT(t, func(c *assert.CollectT) {
conn, err := net.Dial("tcp", endpoint)
//nolint:testifylint
if assert.NoError(c, err) {
conn.Close()
}
}, time.Second*10, time.Millisecond*10)
}, time.Second*10, time.Millisecond*10) {
cli, err := dockerClient.NewClientWithOpts(dockerClient.FromEnv)
require.NoError(t, err)

logs, err := cli.ContainerLogs(ctx, types.ContainerLogsOptions{

Check failure on line 431 in tests/e2e/standalone/init_test.go

View workflow job for this annotation

GitHub Actions / Run Self-Hosted E2E tests in linux_amd64_slim

undefined: ctx

Check failure on line 431 in tests/e2e/standalone/init_test.go

View workflow job for this annotation

GitHub Actions / Run Self-Hosted E2E tests in linux_amd64_slim

not enough arguments in call to cli.ContainerLogs

Check failure on line 431 in tests/e2e/standalone/init_test.go

View workflow job for this annotation

GitHub Actions / Run Self-Hosted E2E tests in linux_amd64_slim

undefined: ctx

Check failure on line 431 in tests/e2e/standalone/init_test.go

View workflow job for this annotation

GitHub Actions / Run Self-Hosted E2E tests in linux_amd64_slim

not enough arguments in call to cli.ContainerLogs

Check failure on line 431 in tests/e2e/standalone/init_test.go

View workflow job for this annotation

GitHub Actions / Run Self-Hosted E2E tests in linux_amd64_complete

undefined: ctx

Check failure on line 431 in tests/e2e/standalone/init_test.go

View workflow job for this annotation

GitHub Actions / Run Self-Hosted E2E tests in linux_amd64_complete

not enough arguments in call to cli.ContainerLogs

Check failure on line 431 in tests/e2e/standalone/init_test.go

View workflow job for this annotation

GitHub Actions / Run Self-Hosted E2E tests in linux_amd64_complete

undefined: ctx

Check failure on line 431 in tests/e2e/standalone/init_test.go

View workflow job for this annotation

GitHub Actions / Run Self-Hosted E2E tests in linux_amd64_complete

not enough arguments in call to cli.ContainerLogs

Check failure on line 431 in tests/e2e/standalone/init_test.go

View workflow job for this annotation

GitHub Actions / Run Self-Hosted E2E tests in darwin_amd64_slim

undefined: ctx

Check failure on line 431 in tests/e2e/standalone/init_test.go

View workflow job for this annotation

GitHub Actions / Run Self-Hosted E2E tests in darwin_amd64_slim

not enough arguments in call to cli.ContainerLogs

Check failure on line 431 in tests/e2e/standalone/init_test.go

View workflow job for this annotation

GitHub Actions / Run Self-Hosted E2E tests in darwin_amd64_slim

undefined: ctx

Check failure on line 431 in tests/e2e/standalone/init_test.go

View workflow job for this annotation

GitHub Actions / Run Self-Hosted E2E tests in darwin_amd64_slim

not enough arguments in call to cli.ContainerLogs

Check failure on line 431 in tests/e2e/standalone/init_test.go

View workflow job for this annotation

GitHub Actions / Run Self-Hosted E2E tests in windows_amd64_slim

undefined: ctx

Check failure on line 431 in tests/e2e/standalone/init_test.go

View workflow job for this annotation

GitHub Actions / Run Self-Hosted E2E tests in windows_amd64_slim

not enough arguments in call to cli.ContainerLogs

Check failure on line 431 in tests/e2e/standalone/init_test.go

View workflow job for this annotation

GitHub Actions / Run Self-Hosted E2E tests in windows_amd64_slim

undefined: ctx

Check failure on line 431 in tests/e2e/standalone/init_test.go

View workflow job for this annotation

GitHub Actions / Run Self-Hosted E2E tests in windows_amd64_slim

not enough arguments in call to cli.ContainerLogs
ShowStdout: true,
ShowStderr: true,
})
require.NoError(t, err)
b, err := io.ReadAll(logs)

Check failure on line 436 in tests/e2e/standalone/init_test.go

View workflow job for this annotation

GitHub Actions / Run Self-Hosted E2E tests in linux_amd64_slim

b declared and not used

Check failure on line 436 in tests/e2e/standalone/init_test.go

View workflow job for this annotation

GitHub Actions / Run Self-Hosted E2E tests in linux_amd64_slim

b declared and not used

Check failure on line 436 in tests/e2e/standalone/init_test.go

View workflow job for this annotation

GitHub Actions / Run Self-Hosted E2E tests in linux_amd64_complete

b declared and not used

Check failure on line 436 in tests/e2e/standalone/init_test.go

View workflow job for this annotation

GitHub Actions / Run Self-Hosted E2E tests in linux_amd64_complete

b declared and not used

Check failure on line 436 in tests/e2e/standalone/init_test.go

View workflow job for this annotation

GitHub Actions / Run Self-Hosted E2E tests in darwin_amd64_slim

b declared and not used

Check failure on line 436 in tests/e2e/standalone/init_test.go

View workflow job for this annotation

GitHub Actions / Run Self-Hosted E2E tests in darwin_amd64_slim

b declared and not used

Check failure on line 436 in tests/e2e/standalone/init_test.go

View workflow job for this annotation

GitHub Actions / Run Self-Hosted E2E tests in windows_amd64_slim

b declared and not used

Check failure on line 436 in tests/e2e/standalone/init_test.go

View workflow job for this annotation

GitHub Actions / Run Self-Hosted E2E tests in windows_amd64_slim

b declared and not used
require.NoError(t, err)
fmt.Printf(">>%s\n", logs)
}
}

0 comments on commit 5679fb4

Please sign in to comment.