Skip to content
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

Docker for Mac 2.0.0.2: empty logs for short-lived containers #1205

Closed
rnorth opened this issue Feb 2, 2019 · 1 comment
Closed

Docker for Mac 2.0.0.2: empty logs for short-lived containers #1205

rnorth opened this issue Feb 2, 2019 · 1 comment

Comments

@rnorth
Copy link
Member

rnorth commented Feb 2, 2019

I've noticed an issue that I can reliably reproduce on Docker for Mac 2.0.0.2, but which does not appear on CI.

org.testcontainers.utility.DirectoryTarResourceTest#simpleRecursiveFileTest will fail ~80% of the time for me. This particular test uses a short-lived container comprising a cat CMD and with OneShotStartupCheckStrategy. The test attaches a ToStringConsumer to logs and waits for the end of stdout logs to be reached.

Some of the time, when the test passes, the log stream callback events are onStart, onNext (containing the desired stdout line) and onComplete.

After adding a little extra instrumentation, it appears that most of the time the log stream callback events are onStart, onComplete. onNext is never fired.

In this situation the test fails. However, when attempting to read the logs later, the correct log message is found.

My hypothesis is that this version of Docker automatically triggers the onComplete event at container exit even if there are unflushed stdout/stderr frames.

@rnorth
Copy link
Member Author

rnorth commented Feb 9, 2019

Bizarrely I don't get this issue on all of my Macs...

bsideup added a commit that referenced this issue Feb 15, 2019
* Start log consumers after startup checks are passing
Fixes #1205

* Add getLogs() method to GenericContainer, and use it for tests

* Fix missing passthrough of output types

* Restore previous behaviour
@rnorth rnorth added this to the 1.11.1 milestone Mar 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant