-
-
Notifications
You must be signed in to change notification settings - Fork 531
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
feat: honour go toolchain's verbose flag to print out logs #2624
Conversation
✅ Deploy Preview for testcontainers-go ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we have this logger
abstraction, and we discussed it in the context of tc-java, could we also log out the used tc-go version, to help us with debugging based on user logs?
Indeed. I'll add it to the initial banner: 2024/07/05 10:58:07 github.com/testcontainers/testcontainers-go - Connected to docker:
Server Version: 78+testcontainerscloud (via Testcontainers Desktop 1.15.0)
API Version: 1.43
Operating System: Ubuntu 20.04 LTS
Total Memory: 7407 MB
+ Testcontainers Go version: v0.31.0
Resolved Docker Host: tcp://127.0.0.1:61939
Resolved Docker Socket Path: /var/run/docker.sock
Test SessionID: 8cd3a6626cd58d51a66a9da017b40ba50c7130e74ee889f1a38ea4160e6a6f57
Test ProcessID: 00327949-4162-4994-b191-746e9b44b300 |
cmd.Env = []string{"GO_WANT_HELPER_PROCESS=1"} | ||
// force verbosity in subprocesses, so that the output is printed | ||
cmd := exec.Command(os.Args[0], "-test.run=TestHelperContainerStarterProcess", "-test.v=true") | ||
cmd.Env = append(os.Environ(), "GO_WANT_HELPER_PROCESS=1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having the environment will make this test more reliable, making it possible to run it locally (e.g., HOME var was not set)
- Add `-v` flag to transparent-proxy test runs: In `testcontainers-go` version 0.32.0, logging is disabled by default unless the `-v` flag is used. This change enables verbose logging for transparent-proxy tests to provide more detailed output, making it easier to debug issues such as test timeouts. - Increase GitHub Action job timeout to 60 minutes: Extended the timeout for the transparent-proxy tests GitHub Action job to 60 minutes to accommodate longer test runs and prevent premature job termination. - Adjust test schedule: Updated the schedule to run these tests 2 hours earlier, ensuring they align better with the team's workflow. ref. testcontainers/testcontainers-go#2624 Signed-off-by: Bart Smykla <[email protected]>
* main: fix: log output after context timeout (#2643) chore(deps): use "github.com/containerd/platforms" instead (#2638) chore(deps): bump google.golang.org/grpc to 1.64.1 (#2635) chore(deps): bump certifi from 2024.2.2 to 2024.7.4 (#2631) chore: prepare for next minor development cycle (0.33.0) chore: use new version (v0.32.0) in modules and examples feat: honour go toolchain's verbose flag to print out logs (#2624) Fix issues in BuildImage() (#2626) docs: indicate version for the Run function (#2627) chore: remove duplicated tests for config (#2628) Log retried errors (#2613)
What does this PR do?
This PR checks if the verbose flags (
v
or-test.v
) are present in the current execution, keeping the default logger if it's passed. Else, a NOOP logger will be used for all the downstream calls.If a container defines its own logger in the container request struct, it will be honored.
Finally, we are including the library version in the initial banner in case users want to provide logs.
Why is it important?
Control the verbosity using standard Go flags
Related issues