A library to support tests with throwaway instances of Docker containers for all compatible .NET Standard versions.
MIT License
Bot releases are visible (Hide)
Thank you to everyone whose contributions made this release possible.
The UntilOperationIsSucceeded(Func<bool>, int, Action<IWaitStrategy>)
wait strategy is obsolete. Instead of this wait strategy, use any other wait strategy that matches your use case and configure the retry behavior accordingly (wait strategy options).
Using reuse together with the container builder method WithName(string)
will generate a new reuse hash the first time you use the configuration. The container name was not included in calculating the reuse hash previously.
/var/lib/mysql-files
directory to prevent older versions from failing to start (#1144) @0xcedPublished by github-actions[bot] 7 months ago
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) @0xcedPublished by github-actions[bot] 9 months ago
Happy New Year and a massive thank you to all the contributors who made the new version of Testcontainers for .NET possible 🙌!
Published by github-actions[bot] 11 months ago
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.
Published by github-actions[bot] about 1 year ago
CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT
env var (#971) @eddumelendezPublished by github-actions[bot] about 1 year ago
Thank you to all contributors for your valuable efforts towards this release. Your contributions are greatly appreciated ❤️.
Published by github-actions[bot] over 1 year ago
Published by github-actions[bot] over 1 year ago
Published by github-actions[bot] over 1 year ago
Published by github-actions[bot] over 1 year ago
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) @HofmeisterAnPublished by github-actions[bot] over 1 year ago
We 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 |
Published by HofmeisterAn almost 2 years ago
As part of this release we had 9 issues closed.
ITestcontainersBuilder<TDockerContainer>.WithResourceMapping
to copy files or any binary contents into the created container before it is startedITestcontainersNetworkBuilder.WithOption
(@vlaskal)TESTCONTAINERS_HOST_OVERRIDE
and TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE
TESTCONTAINERS_RYUK_CONTAINER_PRIVILEGED
)IDockerContainer.Hostname
) of a network if one is assignedResourceReaper.GetAndStartDefaultAsync
no longer support optional arguments, it is necessary to set the Resource Reaper configuration immediately.dockerignore
and Dockerfile
files in tarball (docker build
)Thanks for your contributions 🙏
Published by HofmeisterAn almost 2 years ago
As part of this release we had 24 issues closed.
ITestcontainersBuilder<TDockerContainer>.WithTmpfsMount
(@chrisbbe)DockerEndpointAuthConfig
) on TestcontainersSettings
initializationDOCKER_AUTH_CONFIG
environment variable (@vova-lantsov-dev)MsSqlTestcontainerConfiguration
custom database names (@enginexon)WithDockerfileDirectory
ExecScriptAsync
(MongoDB Shell) to MongoDB moduleIDockerContainer.GetLogs
ITestcontainersBuilder<TDockerContainer>.WithImagePullPolicy
(@BenasB)ITestcontainersBuilder<TDockerContainer>.WithMacAddress
(@seb1992).dockerignore
entry *
to all files and directorieswnameless/oracle-xe-11g-r2
to gvenzl/oracle-xe:21-slim
TestcontainersContainer.DisposeAsync
thread safe (rename TestcontainersState
to TestcontainersStates
).dockerignore
entry ends with /
.dockerignore
entry ends with /*
localhost
Thanks for your contributions 🙏
Published by HofmeisterAn about 2 years ago
As part of this release we had 11 issues closed.
CreateContainerParameters
instance (@Xitric)TestcontainersSettings.ResourceReaperImage
(@vlaskal)~/.testcontainers.properties
custom configurationIImageFromDockerfileBuilder.WithBuildArgument
(@michal-korniak)ResourceReaperDiagnostics
System.InvalidOperationException : cannot hijack chunked or content length stream
(update Docker.DotNet
dependency)ITestcontainersConfiguration
duplication, such as DockerApiException : [...] Duplicate mount point [...]
(@alesandrino)Thanks for your contributions 🙏
Published by HofmeisterAn over 2 years ago
As part of this patch release we had 2 issues closed.
ResourceReaperException
, Testcontainers couldn't establish a connection to the resource reaper (public host port wasn't set)ArgumentNullException
while mapping the network configurations in TestcontainersConfigurationConverter
(@pellared)Published by HofmeisterAn over 2 years ago
With this release, we transferred the repository to the official Testcontainers organization. As part of this release we had 3 issues closed.
WithNetworkAliases
(@vlaskal).HubImageNamePrefix
in combination with private Docker registry credentials (@bohlenc).Published by HofmeisterAn over 2 years ago
As part of this release we had 10 issues closed.
⚠️ This version has breaking changes. It contains a lot of new features, including performance and stability improvements.
DOCKER_HOST
as Docker endpoint (supports custom client configurations).NullReferenceException
when Docker image is not set (@jlevier-ae).ExecResult
instead of the exit code from IDockerContainerOperations.ExecAsync
(@fabiogouw).IDatabaseScript.IDatabaseScript
for TestcontainerDatabase
(@fabiogouw).📝 If your Docker host can't access the domain socket (or IPC socket) /var/run/docker.sock
, disable the Resource Reaper (TestcontainersSettings.ResourceReaperEnabled = false
).
Published by HofmeisterAn over 3 years ago
As part of this release we had 7 issues closed.
WithStartupCallback
.WithNetwork
(@brethubbard).netstandard2.0
(@chrisbbe).StartAsync
cannot be canceled.Environment
.json) was not applied (@as-ivanov).Published by HofmeisterAn about 4 years ago
As part of this release we had 5 issues closed.
SolutionInfo.cs
with Shared.msbuild
..dockerignore
file support.TestcontainersContainer.StartAsync
breaks Coverlet code coverage generation.Published by HofmeisterAn over 4 years ago
As part of this release we had 5 issues closed.
docker-socket
) (by @farodin91)