A library to support tests with throwaway instances of Docker containers for all compatible .NET Standard versions.
Thank you very much to all contributors once again. This version contains really great features and important fixes. Awesome increment ๐.
If you have overwritten the default logger previously (setting TestcontainersSettings.Logger
), please be aware that each builder now offers a dedicated API to configure the actual logger. This has several advantages; among others, it integrates very nicely into xUnit.net's scoped loggers.
WithLogger(ILogger)
builder API (#1100) @0xcedWithLogger(ILogger)
builder API (#1100) @0xcedNullReferenceException
when pulling uncached base images to build an image (#1126) @tom-englertpg_isready
command to assess whether PostgreSQL is ready or not (#1111) @0xcedHappy New Year and a massive thank you to all the contributors who made the new version of Testcontainers for .NET possible ๐!
A heartfelt thank you to each contributor. Your contributions, whether through sharing ideas for improvements, identifying issues, submitting pull requests, or writing articles, are immensely appreciated and help me a lot. THANK YOU for your support.
The members of the container and image builder, WithImagePullPolicy
and WithImageBuildPolicy
, previously received a callback argument of type ImagesListResponse
. We've now updated these callbacks, and they will receive an argument of type ImageInspectResponse
. This change was implemented to offer more detailed information regarding the actual cached image.
CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT
env var (#971) @eddumelendezThank you to all contributors for your valuable efforts towards this release. Your contributions are greatly appreciated โค๏ธ.
We have added and replaced the modules mentioned below. Each module contains its own builder and configuration type, making it much easier to support various test cases. Currently, the modules are designed to quickly spin up common configurations of real dependencies to establish a connection to the application or service running inside it.
We are interested in your opinions and requirements in regards of the module's capabilities. Creating great modules is a community effort, so please consider sharing your thoughts with us and other Testcontainers users in this discussion or in our Slack workspace.
We will continuously add module features and documentation. Currently, information on how to configure and run modules can be found in the tests. If you are already familiar with Testcontainers, you should have no trouble understanding it as the experience is very similar as before. Here is a quick example using xUnit.net:
public sealed class ModuleSupport : IAsyncLifetime
{
private readonly MsSqlContainer _msSqlContainer = new MsSqlBuilder().Build();
public Task InitializeAsync()
{
return _msSqlContainer.StartAsync();
}
public Task DisposeAsync()
{
return _msSqlContainer.DisposeAsync().AsTask();
}
[Fact]
public void ConnectionStateReturnsOpen()
{
// Given
using DbConnection connection = new SqlConnection(_msSqlContainer.GetConnectionString());
// When
connection.Open();
// Then
Assert.Equal(ConnectionState.Open, connection.State);
}
}
Old name | New name |
---|---|
ITestcontainersContainer , IDockerContainer , IRunningDockerContainer |
IContainer |
IDockerImage |
IImage |
IDockerNetwork |
INetwork |
IDockerVolume |
IVolume |
TestcontainersBuilder |
ContainerBuilder |
TestcontainersContainer |
DockerContainer |
TestcontainersNetworkBuilder |
NetworkBuilder |
TestcontainersVolumeBuilder |
VolumeBuilder |
WithCreateContainerParametersModifier |
WithCreateParameterModifier |
IContainer.GetLogsAsync(DateTime, DateTime, bool, CancellationToken)
(#793) @HofmeisterAnWe made a concerted effort to avoid breaking changes as much as possible. Our goal was to provide a smooth transition to the new version for our users. To achieve this, we have flagged all upcoming breaking changes as obsolete, which means that they will still work for now but will be removed in the next version.
However, there may be cases where we are unable to maintain backwards compatibility. In such instances, we will do our best to provide clear documentation and guidance on how to update your code to work with the new version. We apologize in advance for any inconvenience this may cause and we appreciate your understanding.
The interface member IWaitUntil.Until(ITestcontainersContainer, ILogger)
has been changed to IWaitUntil.UntilAsync(IContainer)
. The container instance now holds the instance of ILogger
.
The member ImageFromDockerfileBuilder.Build()
does not return a Task<string>
anymore. It returns an implementation of IFutureDockerImage
. To finally build the image call CreateAsync(CancellationToken)
.
Use the ContainerBuilder
instead of TestcontainersBuilder<TestcontainersContainer>
or ContainerBuilder<DockerContainer>
for generic (non module) configurations. If you rely on the module builder, please be aware of https://github.com/testcontainers/testcontainers-dotnet/issues/750#issuecomment-1412257694 for now.
Following interfaces and classes has been renamed (the old interfaces and classes are still supported in 2.4.0):
Old name | New name |
---|---|
ITestcontainersContainer , IDockerContainer , IRunningDockerContainer |
IContainer |
IDockerImage |
IImage |
IDockerNetwork |
INetwork |
IDockerVolume |
IVolume |
TestcontainersBuilder |
ContainerBuilder |
TestcontainersNetworkBuilder |
NetworkBuilder |
TestcontainersVolumeBuilder |
VolumeBuilder |
TestcontainersContainer |
DockerContainer |