GithubHelp home page GithubHelp logo

testcontainers / testcontainers-dotnet Goto Github PK

View Code? Open in Web Editor NEW
3.5K 31.0 240.0 4.44 MB

A library to support tests with throwaway instances of Docker containers for all compatible .NET Standard versions.

Home Page: https://dotnet.testcontainers.org

License: MIT License

C# 99.85% Shell 0.04% Dockerfile 0.09% Batchfile 0.03%
automation dotnet docker testcontainers test test-framework

testcontainers-dotnet's Introduction

Testcontainers

Open in GitHub Codespaces

NuGet CI/CD Alert Status Coverage

Testcontainers for .NET is a library to support tests with throwaway instances of Docker containers for all compatible .NET Standard versions. The library is built on top of the .NET Docker remote API and provides a lightweight implementation to support your test environment in all circumstances.

Testcontainers Banner

License

See LICENSE.

Copyright

Copyright (c) 2019 - 2024 Andre Hofmeister and other authors.

See contributors for all contributors.


Join our Slack workspace | Testcontainers OSS | Testcontainers Cloud

testcontainers-dotnet's People

Contributors

0xced avatar alesandrino avatar bohlenc avatar chrisbbe avatar dejandjenic avatar dependabot-preview[bot] avatar dependabot[bot] avatar dominikus1993 avatar eddumelendez avatar eshva avatar fabiogouw avatar hofmeisteran avatar jacobjmarks avatar jdelucaa avatar kfrajtak avatar khalidabuhakmeh avatar leocross avatar mgroves avatar michal-korniak-kornit avatar psanetra avatar roji avatar s-rech avatar shaharm7 avatar shiravneri avatar smbecker avatar the-avid-engineer avatar tom-englert avatar vlaskal avatar vlastimilkaluzaysoft avatar xzelsius avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

testcontainers-dotnet's Issues

Add basic Docker features

Extend ContainerBuilder with basic Docker functionalities such as:

  • Check if Docker is up and running. (We will do that in another issue)
  • WithLabel
  • WithName
  • WithEnv
  • WithCmd
  • WithExposedPort
  • WithVolume or WithMount
  • Run docker-compose.yml(We will do that in another issue)
  • Add XML documentation.
  • Use interfaces instead of concrete implementation.
  • Improve Docker calls in GenericContainer keep them asynchronous.
    • Use proper return types.
    • Protect container id.

Clarity on libraries

Is your feature request related to a problem? Please describe.
I'm a bit confused at the moment I saw that you are a contributor on https://github.com/testcontainers/testcontainers-dotnet. What was the reason you created dotnet-testcontainers instead of continuing on the other one ?

Describe the solution you'd like
Maybe add a section to the readme how this relates to testcontainers-dotnet

Describe alternatives you've considered

Additional context

Publish random port

Is your feature request related to a problem? Please describe.
At the moment it is possible to publish a port with a specified binding pair (host, container) whereas in some scenarios I'd like to be able to just specify the container port and let the engine decide on the published host port e.g. docker run -p 80 XZY. This helps in scenarios such as running a database in integration test scenarios on two points:

  • You can still run for instance a postgres instance on the default port
  • You can run test in parallel

Describe the solution you'd like
Overload for WithPortBinding that accepts only the container port

Describe alternatives you've considered
New method WithRandomPortBiding would make it more clear to the user

Cheers & let me know if you like me to create a PR for it

Add missing function `WithDockerCompose`

Is your feature request related to a problem? Please describe.
I love the approach of having a single container scenario for a test case but there are also scenarios where I'd like to spin up a whole set of containers and therefore use docker-compose as declaration.

Describe the solution you'd like
I'd like to spin up a set of containers by specifying a docker-compose.yml similar to the Java version https://www.testcontainers.org/modules/docker_compose/

Describe alternatives you've considered
Not sure If there is one

  • configuring the things as in the compose in code seems odd to me and leads to duplication of configuration and most of the times docker-compose.yml will also be used to deploy the application under test this would be strange.

Additional context
Also other library authors could benefit from such an approach, I happen to know that https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks is using compose and I think it would be great improvement on there development experience (since you don' t have to remember starting the containers in advance ;) )

Cheers & let me know what you think of the idea

Update pre-configured Testcontainers

Is your feature request related to a problem? Please describe.

The pre-configured Testcontainers (Docker base image versions) are outdated.

Describe the solution you'd like.

Update the pre-configured Testcontainers to the latest version.

  • MySql
  • PostgreSql
  • Redis
  • RabbitMQ

Describe alternatives you've considered.

-

Additional context.

-

Forward errors if Docker API calls fail

This bug is in most cases related to TestcontainersClient. Is, for example, the required host port already in use, Testcontainers does not throw any errors. It will wait forever until the container is created (this will never happen).

Add missing function to purge orphaned containers if they are not disposed

Is your feature request related to a problem? Please describe.
In certain circumstances containers remain when tests are aborted or fail with an error.

Describe the solution you'd like
It seems like AppDomain.CurrentDomain.ProcessExit and Console.CancelKeyPress is not working properly (at least on macOS) e. g. STRG + C does not exit the application gracefully. Any other way? See also: dotnet/coreclr#8565.

Describe alternatives you've considered
We can probably use Microsoft.Extensions.Hosting, however, it seems like not working reliable on macOS. IHostedService.StopAsync gets "skipped".

Additional context
n/a

Add native Windows container support

If Docker runs with Windows engine (DockerCli.exe -SwitchWindowsEngine), .NET Testcontainers supports Windows container already. However, the behavior is not convenient. We need a simple and convenient solution to switch between both engines within the library.

Add documentation

Are there any frameworks or techniques for good documentation? Maybe something like AsciiDoc or GitHub Wiki?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.