-
-
Notifications
You must be signed in to change notification settings - Fork 511
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
chore: enable implicit default logger only in testing with -v #2877
Conversation
✅ Deploy Preview for testcontainers-go ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@apstndb thanks for opening the issue and working on the fix. I have one question about your use case: What do you expect when From what I can see with the implementation in this PR, for the use case above of executing Could you share more on your use case so we can understand better the needs behind it? 🙏 |
My expectation is that
It means the current behavior of enforcing In this case, users can implement their own handling by explicitly setting |
@apstndb so IIUC, you are using testcontainers-go outside a test suite as, my guess, the runtime of a software that spins up containers, right? Then I think you're right and we should consider this, but want to double check with you about your use case. |
Yes! |
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.
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.
LGTM, thanks!
@apstndb one final question: in your case, using tc-go as part of another library, how would you get testcontainers logs? IIUC this code, it will enable the verbose mode only when testing is enabled, which is not your case, right? |
It is right, my case don't show tc-go logs currently.
I think we can pass some options to the wrapper library like |
Merged, thanks for your work! |
* main: (234 commits) chore(ci): add Github labels based on PR title (testcontainers#2914) chore(gha): Use official setup-docker-action (testcontainers#2913) chore(ci): enforce conventional commits syntax in PR titles (testcontainers#2911) feat(nats): WithConfigFile - pass a configuration file to nats server (testcontainers#2905) chore: enable implicit default logger only in testing with -v (testcontainers#2877) fix: container binds syntax (testcontainers#2899) refactor(cockroachdb): to use request driven options (testcontainers#2883) chore(deps): bump actions/setup-go from 5.0.0 to 5.1.0 (testcontainers#2904) chore(deps): bump ossf/scorecard-action from 2.3.1 to 2.4.0 (testcontainers#2903) chore(deps): bump test-summary/action from 2.3 to 2.4 (testcontainers#2902) feat(wait): strategy walk (testcontainers#2895) feat(wait): tls strategy (testcontainers#2896) docs: better contribution guidelines (testcontainers#2893) fix(influxdb): Respect custom waitStrategy (testcontainers#2845) fix: only upload to sonar on ubuntu-latest (testcontainers#2891) fix: build artifact name properly (testcontainers#2890) fix: do not run sonar upload when ryuk is disabled (testcontainers#2889) fix: update GH actions for uploading/downloading artifacts (testcontainers#2888) feat(ci): Enable master moby with rootless (testcontainers#2880) fix(redpanda): temporary file use ...
* main: feat(gcloud)!: add support to seed data when using RunBigQueryContainer (testcontainers#2523) security(deps): bump golang.org/x/crypto from 0.28.0 to 0.31.0 (testcontainers#2916) chore(ci): add Github labels based on PR title (testcontainers#2914) chore(gha): Use official setup-docker-action (testcontainers#2913) chore(ci): enforce conventional commits syntax in PR titles (testcontainers#2911) feat(nats): WithConfigFile - pass a configuration file to nats server (testcontainers#2905) chore: enable implicit default logger only in testing with -v (testcontainers#2877) fix: container binds syntax (testcontainers#2899) refactor(cockroachdb): to use request driven options (testcontainers#2883)
What does this PR do?
This PR changes
-v
and-test.v=true
handling only takes effect iftesting.Testing() = true
, i.e.go test
.Why is it important?
The current implementation always treats
-v
and-test.v=true
specially, even outside ofgo test
, and outputs verbose logs that are not easy to suppress. This makes it difficult to use testcontainers outside ofgo test
.Related issues
How to test this PR
These behaviors should not be changed.
These behavior will be changed to suppress default logging.