dotnet-testcontainers | support tests with throwaway instances | Unit Testing library

 by   HofmeisterAn C# Version: 1.5.0 License: MIT

kandi X-RAY | dotnet-testcontainers Summary

kandi X-RAY | dotnet-testcontainers Summary

dotnet-testcontainers is a C# library typically used in Testing, Unit Testing, Docker applications. dotnet-testcontainers has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can download it from GitHub.

🐋 A library to support tests with throwaway instances of Docker containers for all compatible .NET Standard versions.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              dotnet-testcontainers has a medium active ecosystem.
              It has 1028 star(s) with 64 fork(s). There are 23 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 8 open issues and 118 have been closed. On average issues are closed in 34 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of dotnet-testcontainers is 1.5.0

            kandi-Quality Quality

              dotnet-testcontainers has 0 bugs and 0 code smells.

            kandi-Security Security

              dotnet-testcontainers has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              dotnet-testcontainers code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              dotnet-testcontainers is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              dotnet-testcontainers releases are available to install and integrate.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of dotnet-testcontainers
            Get all kandi verified functions for this library.

            dotnet-testcontainers Key Features

            No Key Features are available at this moment for dotnet-testcontainers.

            dotnet-testcontainers Examples and Code Snippets

            No Code Snippets are available at this moment for dotnet-testcontainers.

            Community Discussions

            QUESTION

            Mountebank imposter ports not accessible when mountebank started using dotnet-testcontainers
            Asked 2021-Dec-02 at 05:38

            I am using dotnet-testcontainers https://github.com/HofmeisterAn/dotnet-testcontainers to spin up a container with mountebank in my xUnit test. I can successfully create a mountebank client and create an imposter successfully. The issue is that when the test is run, the app tries to make a call to the imposter on http://localhost:3000 and gets connection refused.

            I can successfully open http://localhost:2525 and can see Mountebank default page. So mountebank is running fine. I also confirmed that the imposter was created successfully on port 3000 by looking at docker container log. I also tried to use Postman to make a call to my imposter at http:localhost:3000 and get connection refused.

            What could be the issue? Is this an issue that port 3000 in the docker container is not exposed or something? Below is my code:

            ...

            ANSWER

            Answered 2021-Dec-02 at 05:38

            Might be useful for someone else who would face this issue. Figured out what the issue was. I was not mapping the host port and the imposter port in the container. Read about published ports https://docs.docker.com/config/containers/container-networking/ and used WithExposedPort(3000) and then did port binding of that port with host port using WithPortBinding(3000,3000) where the first port in this method is host port and second port is container port.

            Source https://stackoverflow.com/questions/70165557

            QUESTION

            Calling thirdparty container with .net core TestHost/TestServer via SSL: Bypass SSL Validation using Testservers CreateClient() method
            Asked 2021-Feb-06 at 16:26

            I am trying to add keycloak as a testcontainer to my .net core (5) integration tests using the dotnet-testcontainers library .

            My Problem is, I am struggling with HTTPS-Support having a container using self-signed certificates and TestServer-Class for my integration tests.

            To be precise, I am using Microsofts TestServer class to create real API requests with an in-memory config for using a keycloak-testcontainer with exposed port 8443 and its self-signed certificate.

            The Problem is: I can’t add a HttpClientHandler to TestServers HttpClient(created via serverCreateClient()) to allow non-trusted certs within this handler. I have created a concrete example here on branch apitests-https. The failing test can be found here, its in the SucceedsWhenGetRequestWithTokenReturnsListOfArticlestest method. I added some Comments to the class and the Startup.cs of DemoApi - Project that shows what i've tried.

            As a result, the TestServers internal Jwt Middleware uses the default HttpClient and throws the following AuthenticationException:

            ...

            ANSWER

            Answered 2021-Feb-06 at 16:26

            Ok, I worked it out. Imho it is not the best solution, but as long as I don't have another one, this should work. All I had to do was:

            1. Add IWebHostEnvironment as a field to Startup.cs and inject in in Startup() constructor.

            Startup then looks like this:

            Source https://stackoverflow.com/questions/66062832

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install dotnet-testcontainers

            You can download it from GitHub.

            Support

            .NET Testcontainers supports Windows, Linux, and macOS as host systems. Linux Docker containers are supported on all three operating systems.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/HofmeisterAn/dotnet-testcontainers.git

          • CLI

            gh repo clone HofmeisterAn/dotnet-testcontainers

          • sshUrl

            git@github.com:HofmeisterAn/dotnet-testcontainers.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link