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

Get information about the Testcontainers environment #603

Closed
3 tasks done
HofmeisterAn opened this issue Oct 5, 2022 · 2 comments · Fixed by #684
Closed
3 tasks done

Get information about the Testcontainers environment #603

HofmeisterAn opened this issue Oct 5, 2022 · 2 comments · Fixed by #684
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@HofmeisterAn
Copy link
Collaborator

HofmeisterAn commented Oct 5, 2022

Is your feature request related to a problem? Please describe.
In case of questions or bugs, information about the development environment (e.g. the Docker or Testcontainers version) are sometimes missing. Those information will help a lot to understand or categorize the issue.

Describe the solution you'd like

  • Show a warning if no logger implementation is provided.
  • Before Testcontainers creates any resources, it should output information about its state and environment.
  • Add access to Docker Engine (server) information

Describe alternatives you've considered
-

Additional context
-

@HofmeisterAn HofmeisterAn added the enhancement New feature or request label Oct 5, 2022
@HofmeisterAn HofmeisterAn added this to the 2.2.0 milestone Oct 5, 2022
@HofmeisterAn HofmeisterAn self-assigned this Oct 6, 2022
@kiview
Copy link
Member

kiview commented Oct 18, 2022

The first 2 seem more important, for the 3rd point, it depends if there are actual use cases for it.

@HofmeisterAn
Copy link
Collaborator Author

HofmeisterAn commented Oct 19, 2022

Ok, this is now the time all other languages make fun of .NET 😅. Yesterday I remembered again, logging to console from .NET tests is not that easy, especially not for us. We are in between of many test frameworks and applications. As far as I know, this is a limitation of the VSTest runner, you cannot simply write to console and expect an output (microsoft/vstest#799) 🤡.

Writing something to console goes usually through the test framework (xUnit.net has ITestOutputHelper, NUnit has TestContext, etc.). This is not a problem if you write tests for yourself, you just use whatever the test framework provides - but we cannot do that.

We need to ensure that our information is written in many different combinations:

  • Via CLI (dotnet test)
  • Via IDE (different output windows)
  • Different test frameworks

I am not 100% sure why the current configuration partialy works with Serilog. E.g. we get an output in the pipeline (Ubuntu and Windows), in the IDE (Rider), but not on console (local). This is probably due to the Test Adapter, but at least in the pipeline and console it should be the same.

How can we add the feature?

  • Write our own implementation of ITestLogger, ITestLoggerWithParameters.
  • Write our own Test Adapter (I made a PoC, it works but I am not happy with it).
  • Write to a file if the dev does not provide its own configuration (might be difficult to provide in some cases).
  • Understand why Serilog partialy works.

The above suggestions need to ensure, that they work well with the test framework solution. E.g. my Test Adapter PoC messed up the output (indention, different prefix, etc.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants