feat: Add traceability and log messages #15
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We've noticed that developers occasionally run into issues while using Testcontainers for .NET, especially when working with alternative container runtimes like Podman or Rancher Desktop. These problems seem to originate from the upstream dependency Docker.DotNet.
The issues typically involve failures in processing response messages. Something goes wrong in the communication layer. So far, Docker.DotNet hasn't offered an easy way to trace or debug these kinds of issues, making it super complex and time consuming to figure out what's actually going wrong.
This PR introduces the first step towards improving traceability and debuggability in Docker.DotNet:
CreateClient(Version, ILogger)
method now accepts anILogger
instance. Developers can pass in their own logger to capture detailed logs from Docker.DotNet.BufferedReadStream
implementation. It logs:BufferedReadStream
extracts lines separated by\r\n
.TestFixture
. I also added support for xUnit.net'sIMessageSink
to capture log output during tests.How to view logs in Rider
To view the logger output in JetBrains Rider:
File | Settings | Build, Execution, Deployment | Unit Testing | Test Runner
.Logging level
toVERBOSE
.Not exactly sure where they show up in Visual Studio, if anyone knows, feel free to drop a comment.
Follow-ups
While I was working on this branch, I noticed that sending messages to
stdin
does not work properly, regardless of whether we are attached to the container or running a command inside it. Additionally, I found that the entireIExecOperations
interface is not well-structured, and the models are outdated. We need to address these issues in a separate PR.