Open apstndb opened 2 weeks ago
Name | Link |
---|---|
Latest commit | a9fbef94b9994ee0e703f512032211dbbeca7f7a |
Latest deploy log | https://app.netlify.com/sites/testcontainers-go/deploys/672b410bbe58800008652a73 |
Deploy Preview | https://deploy-preview-2877--testcontainers-go.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
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 go run -v
is executed?
From what I can see with the implementation in this PR, for the use case above of executing go run -v
, we are going to always suppress the logging. I'd expect the -v
flag enables the logging.
Could you share more on your use case so we can understand better the needs behind it? 🙏
My expectation is that go run ./
(or binary built by go build
) won't generally follow go test
convention.
-test.v=true
.--verbose
or -vv
for vebose mode, and it can even use -v
for other purpose.It means the current behavior of enforcing go test
convention to go run ./
is not good.
In this case, users can implement their own handling by explicitly setting testcontainers.Logger = logger
or testcontainers.WithLogger(logger)
. It is not hard.
@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.
so IIUC, you are using testcontainers-go outside a test suite as, my guess, the runtime of a software that spins up containers, right?
Yes!
This is a combination of interactive tools and the Spanner emulator, so you could call it testing in the broadest sense, but it has nothing to do with the go test
framework or unit testing.
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.