Skip to content

Commit 63733f6

Browse files
authored
Merge branch 'develop' into ssl-config-dotnet
2 parents 99f7596 + 7eec4ce commit 63733f6

File tree

20 files changed

+112
-39
lines changed

20 files changed

+112
-39
lines changed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Project>
33
<PropertyGroup>
44
<PackageId>$(AssemblyName)</PackageId>
5-
<Version>4.7.0</Version>
5+
<Version>4.8.0</Version>
66
<AssemblyVersion>$(Version)</AssemblyVersion>
77
<FileVersion>$(Version)</FileVersion>
88
<Product>Testcontainers</Product>

docs/api/create_docker_container.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ Starting a container or creating a resource (such as a network or a volume) can
7676

7777
```csharp title="Canceling container start after one minute"
7878
using var timeoutCts = new CancellationTokenSource(TimeSpan.FromMinutes(1));
79-
await _container.StartAsync(timeoutCts.Token);
79+
await _container.StartAsync(timeoutCts.Token)
80+
.ConfigureAwait(false);
8081
```
8182

8283
## Getting log messages
@@ -86,7 +87,8 @@ Testcontainers for .NET provides two approaches for retrieving log messages from
8687
The `GetLogsAsync` method is available through the `IContainer` interface. It allows you to fetch logs from a container for a specific time range or from the beginning until the present. This approach is useful for retrieving logs after a test has run, especially when troubleshooting issues or failures.
8788

8889
```csharp title="Getting all log messages"
89-
var (stdout, stderr) = await _container.GetLogsAsync();
90+
var (stdout, stderr) = await _container.GetLogsAsync()
91+
.ConfigureAwait(false);
9092
```
9193

9294
The `WithOutputConsumer` method is part of the `ContainerBuilder` class and is used to continuously forward container log messages to a specified output consumer. This approach provides real-time access to logs as the container runs.

docs/modules/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ await moduleNameContainer.StartAsync();
7373
| Typesense | `typesense/typesense:28.0` | [NuGet](https://www.nuget.org/packages/Testcontainers.Typesense) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.Typesense) |
7474
| Weaviate | `semitechnologies/weaviate:1.26.14` | [NuGet](https://www.nuget.org/packages/Testcontainers.Weaviate) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.Weaviate) |
7575
| WebDriver | `selenium/standalone-chrome:110.0` | [NuGet](https://www.nuget.org/packages/Testcontainers.WebDriver) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.WebDriver) |
76+
| WireMock | - | [NuGet](https://www.nuget.org/packages/WireMock.Net.Testcontainers) | [Source](https://github.com/wiremock/WireMock.Net) |
7677

7778
## Implement a module
7879

examples/Flyway/Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<ItemGroup>
77
<!-- Unit and integration test dependencies: -->
88
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1"/>
9-
<PackageVersion Include="Testcontainers.PostgreSql" Version="4.2.0"/>
9+
<PackageVersion Include="Testcontainers.PostgreSql" Version="4.7.0"/>
1010
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2"/>
1111
<PackageVersion Include="xunit" Version="2.9.2"/>
1212
<!-- Third-party client dependencies to connect and interact with the containers: -->

examples/Respawn/Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<ItemGroup>
77
<!-- Unit and integration test dependencies: -->
88
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1"/>
9-
<PackageVersion Include="Testcontainers.PostgreSql" Version="4.2.0"/>
9+
<PackageVersion Include="Testcontainers.PostgreSql" Version="4.7.0"/>
1010
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2"/>
1111
<PackageVersion Include="xunit" Version="2.9.2"/>
1212
<!-- Third-party client dependencies to connect and interact with the containers: -->

examples/WeatherForecast/Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<!-- Unit and integration test dependencies: -->
1111
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1"/>
1212
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.13"/>
13-
<PackageVersion Include="Testcontainers.PostgreSql" Version="4.2.0"/>
13+
<PackageVersion Include="Testcontainers.PostgreSql" Version="4.7.0"/>
1414
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2"/>
1515
<PackageVersion Include="xunit" Version="2.9.2"/>
1616
<!-- Third-party client dependencies to connect and interact with the containers: -->

examples/WeatherForecast/tests/WeatherForecast.Tests/WeatherForecastContainer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public WeatherForecastContainer()
4040
.WithEnvironment("ASPNETCORE_Kestrel__Certificates__Default__Path", WeatherForecastImage.CertificateFilePath)
4141
.WithEnvironment("ASPNETCORE_Kestrel__Certificates__Default__Password", WeatherForecastImage.CertificatePassword)
4242
.WithEnvironment("ConnectionStrings__PostgreSQL", postgreSqlConnectionString)
43-
.WithWaitStrategy(Wait.ForUnixContainer().UntilPortIsAvailable(WeatherForecastImage.HttpsPort))
43+
.WithWaitStrategy(Wait.ForUnixContainer().UntilInternalTcpPortIsAvailable(WeatherForecastImage.HttpsPort))
4444
.Build();
4545
}
4646

src/Testcontainers.Keycloak/KeycloakBuilder.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,22 @@ public KeycloakBuilder WithPassword(string password)
6060
.WithEnvironment("KEYCLOAK_ADMIN_PASSWORD", password);
6161
}
6262

63+
/// <summary>
64+
/// Configures Keycloak to import a realm configuration file during startup.
65+
/// </summary>
66+
/// <remarks>
67+
/// The file will be copied to the <c>/opt/keycloak/data/import/</c> directory
68+
/// inside the container:
69+
/// https://www.keycloak.org/server/importExport#_importing_a_realm_during_startup.
70+
/// </remarks>
71+
/// <param name="realmConfigurationFilePath">The local path to the realm configuration file (JSON).</param>
72+
/// <returns>A configured instance of <see cref="KeycloakBuilder" />.</returns>
73+
public KeycloakBuilder WithRealm(string realmConfigurationFilePath)
74+
{
75+
return WithCommand("--import-realm")
76+
.WithResourceMapping(realmConfigurationFilePath, "/opt/keycloak/data/import/");
77+
}
78+
6379
/// <inheritdoc />
6480
public override KeycloakContainer Build()
6581
{

src/Testcontainers.Weaviate/WeaviateBuilder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ protected override WeaviateBuilder Init()
4242
.WithEnvironment("AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED", "true")
4343
.WithEnvironment("PERSISTENCE_DATA_PATH", "/var/lib/weaviate")
4444
.WithWaitStrategy(Wait.ForUnixContainer()
45-
.UntilPortIsAvailable(WeaviateHttpPort)
46-
.UntilPortIsAvailable(WeaviateGrpcPort)
45+
.UntilInternalTcpPortIsAvailable(WeaviateHttpPort)
46+
.UntilInternalTcpPortIsAvailable(WeaviateGrpcPort)
4747
.UntilHttpRequestIsSucceeded(request =>
4848
request.ForPath("/v1/.well-known/ready").ForPort(WeaviateHttpPort)));
4949

src/Testcontainers/Configurations/WaitStrategies/IWaitForContainerOS.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,6 @@ public interface IWaitForContainerOS
5858
[PublicAPI]
5959
IWaitForContainerOS UntilCommandIsCompleted(IEnumerable<string> command, Action<IWaitStrategy> waitStrategyModifier = null);
6060

61-
/// <summary>
62-
/// Waits until the port is available.
63-
/// </summary>
64-
/// <param name="port">The port to be checked.</param>
65-
/// <param name="waitStrategyModifier">The wait strategy modifier to cancel the readiness check.</param>
66-
/// <returns>A configured instance of <see cref="IWaitForContainerOS" />.</returns>
67-
[PublicAPI]
68-
[Obsolete("Use UntilInternalTcpPortIsAvailable or UntilExternalTcpPortIsAvailable instead. This method corresponds to the internal variant.")]
69-
IWaitForContainerOS UntilPortIsAvailable(int port, Action<IWaitStrategy> waitStrategyModifier = null);
70-
7161
/// <summary>
7262
/// Waits until a TCP port is available from within the container itself.
7363
/// This verifies that a service inside the container is listening on the specified port.

0 commit comments

Comments
 (0)