Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/Flyway/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<ItemGroup>
<!-- Unit and integration test dependencies: -->
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1"/>
<PackageVersion Include="Testcontainers.PostgreSql" Version="4.7.0"/>
<PackageVersion Include="Testcontainers.PostgreSql" Version="4.10.0"/>
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2"/>
<PackageVersion Include="xunit" Version="2.9.2"/>
<!-- Third-party client dependencies to connect and interact with the containers: -->
Expand Down
8 changes: 3 additions & 5 deletions examples/Flyway/tests/Flyway.Tests/DbFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ public DbFixture()
// as soon as the database is ready. Once the migration is finished, the Flyway
// container exits, and the database container becomes available for tests.

_postgreSqlContainer = new PostgreSqlBuilder()
.WithImage("postgres:15-alpine")
_postgreSqlContainer = new PostgreSqlBuilder("postgres:15-alpine")
.WithNetwork(_network)
.WithNetworkAliases(nameof(_postgreSqlContainer))
.Build();
Expand All @@ -30,8 +29,7 @@ public DbFixture()
// the files are available as soon as the container starts. Flyway will
// automatically pick them up and start the database migration process.

_flywayContainer = new ContainerBuilder()
.WithImage("flyway/flyway:9-alpine")
_flywayContainer = new ContainerBuilder("flyway/flyway:9-alpine")
.WithResourceMapping("migrate/", "/flyway/sql/")
.WithCommand("-url=jdbc:postgresql://" + nameof(_postgreSqlContainer) + "/")
.WithCommand("-user=" + PostgreSqlBuilder.DefaultUsername)
Expand All @@ -40,7 +38,7 @@ public DbFixture()
.WithCommand("migrate")
.WithNetwork(_network)
.DependsOn(_postgreSqlContainer)
.WithWaitStrategy(Wait.ForUnixContainer().AddCustomWaitStrategy(new MigrationCompleted()))
.WithWaitStrategy(Wait.ForUnixContainer().AddCustomWaitStrategy(new MigrationCompleted(), o => o.WithMode(WaitStrategyMode.OneShot)))
.Build();
}

Expand Down
4 changes: 2 additions & 2 deletions examples/Respawn/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
<ItemGroup>
<!-- Unit and integration test dependencies: -->
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1"/>
<PackageVersion Include="Testcontainers.PostgreSql" Version="4.7.0"/>
<PackageVersion Include="Testcontainers.PostgreSql" Version="4.10.0"/>
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2"/>
<PackageVersion Include="xunit" Version="2.9.2"/>
<!-- Third-party client dependencies to connect and interact with the containers: -->
<PackageVersion Include="Npgsql" Version="6.0.11"/>
<PackageVersion Include="Respawn" Version="6.2.1"/>
<PackageVersion Include="Respawn" Version="7.0.0"/>
</ItemGroup>
</Project>
3 changes: 1 addition & 2 deletions examples/Respawn/tests/Respawn.Tests/DbFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ public DbFixture()
// Testcontainers starts the dependent database (PostgreSQL) and copies the SQL scripts
// to the container before it starts. The PostgreSQL container runs the scripts
// automatically during startup, creating the database schema.
_postgreSqlContainer = new PostgreSqlBuilder()
.WithImage("postgres:15-alpine")
_postgreSqlContainer = new PostgreSqlBuilder("postgres:15-alpine")
.WithResourceMapping("migrate/", "/docker-entrypoint-initdb.d/")
.Build();
}
Expand Down
10 changes: 5 additions & 5 deletions examples/WeatherForecast/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="8.0.13"/>
<PackageVersion Include="Microsoft.Fast.Components.FluentUI" Version="3.5.5"/>
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.11"/>
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="10.0.1"/>
<PackageVersion Include="Microsoft.Fast.Components.FluentUI" Version="3.8.0"/>
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.0"/>
<!-- Unit and integration test dependencies: -->
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1"/>
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.13"/>
<PackageVersion Include="Testcontainers.PostgreSql" Version="4.7.0"/>
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.1"/>
<PackageVersion Include="Testcontainers.PostgreSql" Version="4.10.0"/>
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2"/>
<PackageVersion Include="xunit" Version="2.9.2"/>
<!-- Third-party client dependencies to connect and interact with the containers: -->
Expand Down
2 changes: 1 addition & 1 deletion examples/WeatherForecast/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ RUN dotnet restore $CSPROJ_FILE_PATH

RUN dotnet publish $CSPROJ_FILE_PATH --configuration Release --framework net10.0 --runtime linux-x64 --self-contained false --output out /p:DebugType=None /p:DebugSymbols=false

FROM mcr.microsoft.com/dotnet/aspnet:8.0
FROM mcr.microsoft.com/dotnet/aspnet:10.0
ARG RESOURCE_REAPER_SESSION_ID="00000000-0000-0000-0000-000000000000"
LABEL "org.testcontainers.resource-reaper-session"=$RESOURCE_REAPER_SESSION_ID
WORKDIR /app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace WeatherForecast;

public sealed class DatabaseContainer : IHostedService
{
private readonly PostgreSqlContainer _postgreSqlContainer = new PostgreSqlBuilder().Build();
private readonly PostgreSqlContainer _postgreSqlContainer = new PostgreSqlBuilder("postgres:15.1").Build();
Comment thread
HofmeisterAn marked this conversation as resolved.

public Task StartAsync(CancellationToken cancellationToken)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace WeatherForecast.InProcess.Tests;
[UsedImplicitly]
public sealed class WeatherForecastTest : IAsyncLifetime
{
private readonly PostgreSqlContainer _postgreSqlContainer = new PostgreSqlBuilder().Build();
private readonly PostgreSqlContainer _postgreSqlContainer = new PostgreSqlBuilder("postgres:15.1").Build();

public Task InitializeAsync()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace WeatherForecast.Tests;
[UsedImplicitly]
public sealed class WeatherForecastContainer : HttpClient, IAsyncLifetime
{
private static readonly X509Certificate Certificate = new X509Certificate2(WeatherForecastImage.CertificateFilePath, WeatherForecastImage.CertificatePassword);
private static readonly X509Certificate Certificate = X509CertificateLoader.LoadPkcs12FromFile(WeatherForecastImage.CertificateFilePath, WeatherForecastImage.CertificatePassword);

private static readonly WeatherForecastImage Image = new WeatherForecastImage();

Expand All @@ -27,13 +27,12 @@ public WeatherForecastContainer()
_weatherForecastNetwork = new NetworkBuilder()
.Build();

_postgreSqlContainer = new PostgreSqlBuilder()
_postgreSqlContainer = new PostgreSqlBuilder("postgres:15.1")
.WithNetwork(_weatherForecastNetwork)
.WithNetworkAliases(weatherForecastStorage)
.Build();

_weatherForecastContainer = new ContainerBuilder()
.WithImage(Image)
_weatherForecastContainer = new ContainerBuilder(Image)
.WithNetwork(_weatherForecastNetwork)
.WithPortBinding(WeatherForecastImage.HttpsPort, true)
.WithEnvironment("ASPNETCORE_URLS", "https://+")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public sealed class WeatherForecastImage : IImage, IAsyncLifetime

public string Digest => _image.Digest;

public string Platform => _image.Platform;

public string FullName => _image.FullName;

public async Task InitializeAsync()
Expand Down