testcontainers / testcontainers-go

Testcontainers for Go is a Go package that makes it simple to create and clean up container-based dependencies for automated integration/smoke tests. The clean, easy-to-use API enables developers to programmatically define containers that should be run as part of a test and clean up those resources when the test is done.
https://golang.testcontainers.org
MIT License
3.3k stars 450 forks source link

chore: improve log handling when container is stopping #2601

Closed ash2k closed 1 week ago

ash2k commented 1 week ago

What does this PR do?

I'm getting an error when my container cleanly stops:

container log error: EOF. Stopping log consumer: Headers out of sync

Please see individual commits. I tried to tidy up a bit, I hope this is fine.

Why is it important?

The error is a red herring and distracts users of the library.

Related issues

netlify[bot] commented 1 week ago

Deploy Preview for testcontainers-go ready!

Name Link
Latest commit 354d95e51cf02950f994f16e3f49d4e70a974e68
Latest deploy log https://app.netlify.com/sites/testcontainers-go/deploys/66764fb834a32c00082b1fdd
Deploy Preview https://deploy-preview-2601--testcontainers-go.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

mdelapenya commented 1 week ago

@ash2k do you think it's possible to write a test replicating the scenario where the container is stopped and the error is not present anymore?

ash2k commented 1 week ago

I'm not sure how to test this. Start a container, emit logs, check that there is no error written to stderr? Seems too complicated just to test if a log line is written. Are there any similar tests?

ash2k commented 1 week ago

@mdelapenya Friendly ping. I'd like to get this merged as I'd like to send a few more PRs and ideally don't want to have more than one in flight.