Released .NET Testcontainers 0.0.4
Something more than a week ago I started this project and I would like to introduce you to the recent progress. Since then, I've been able to add a lot of features to the project. Currently, Testcontainers supports the basic functionality of Docker and makes complex tests much easier. Following commands are supported:
- WithImage
- WithName
- WithWorkingDirectory
- WithEntrypoint
- WithCommand
- WithEnvironment
- WithLabel
- WithExposedPort
- WithPortBinding
- WithMount
A detailed description of the functions, as well as use cases, can be found on the source repository. Have also a look into the test class, it contains some examples too. Here's a short one:
```chsarp var target = "tmp";
var file = "dayOfWeek";
var dayOfWeek = DateTime.Now.DayOfWeek.ToString();
var testcontainersBuilder = new TestcontainersBuilder() .WithImage("nginx") .WithMount(".", $"/{target}") .WithEnvironment("dayOfWekk", dayOfWeek) .WithCommand("/bin/bash", "-c", $"printf $dayOfWekk > /{target}/{file}");
using (var testcontainer = testcontainersBuilder.Build()) { await testcontainer.StartAsync(); }
// Text contains dayOfWeek. string text = File.ReadAllText($"./{file}"); ```
Next, I will:
- Move NuGet beta versions to a different package manager.
- I like the continuous delivery idea. However, it looks a bit messy - what do you think?
- Create and update the documentation for the internal classes, methods, and interfaces.
- Reduce the number of parameters in the constructor of
TestcontainersBuilder. - Add authentication for private Docker Hubs.
- Pre-configured test containers.
I'm looking forward to your feedback, I wish you all a nice weekend, stay tuned!
Source repository: https://github.com/HofmeisterAn/dotnet-testcontainers
0 comments:
Post a Comment