Skip to content

Commit 20b031b

Browse files
committed
chore: Update examples to TC for .NET 4.10.0
1 parent d66a9f1 commit 20b031b

File tree

10 files changed

+20
-22
lines changed

10 files changed

+20
-22
lines changed

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.7.0"/>
9+
<PackageVersion Include="Testcontainers.PostgreSql" Version="4.10.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/Flyway/tests/Flyway.Tests/DbFixture.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ public DbFixture()
1919
// as soon as the database is ready. Once the migration is finished, the Flyway
2020
// container exits, and the database container becomes available for tests.
2121

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

33-
_flywayContainer = new ContainerBuilder()
34-
.WithImage("flyway/flyway:9-alpine")
32+
_flywayContainer = new ContainerBuilder("flyway/flyway:9-alpine")
3533
.WithResourceMapping("migrate/", "/flyway/sql/")
3634
.WithCommand("-url=jdbc:postgresql://" + nameof(_postgreSqlContainer) + "/")
3735
.WithCommand("-user=" + PostgreSqlBuilder.DefaultUsername)
@@ -40,7 +38,7 @@ public DbFixture()
4038
.WithCommand("migrate")
4139
.WithNetwork(_network)
4240
.DependsOn(_postgreSqlContainer)
43-
.WithWaitStrategy(Wait.ForUnixContainer().AddCustomWaitStrategy(new MigrationCompleted()))
41+
.WithWaitStrategy(Wait.ForUnixContainer().AddCustomWaitStrategy(new MigrationCompleted(), o => o.WithMode(WaitStrategyMode.OneShot)))
4442
.Build();
4543
}
4644

examples/Respawn/Directory.Packages.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
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.7.0"/>
9+
<PackageVersion Include="Testcontainers.PostgreSql" Version="4.10.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: -->
1313
<PackageVersion Include="Npgsql" Version="6.0.11"/>
14-
<PackageVersion Include="Respawn" Version="6.2.1"/>
14+
<PackageVersion Include="Respawn" Version="7.0.0"/>
1515
</ItemGroup>
1616
</Project>

examples/Respawn/tests/Respawn.Tests/DbFixture.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ public DbFixture()
1010
// Testcontainers starts the dependent database (PostgreSQL) and copies the SQL scripts
1111
// to the container before it starts. The PostgreSQL container runs the scripts
1212
// automatically during startup, creating the database schema.
13-
_postgreSqlContainer = new PostgreSqlBuilder()
14-
.WithImage("postgres:15-alpine")
13+
_postgreSqlContainer = new PostgreSqlBuilder("postgres:15-alpine")
1514
.WithResourceMapping("migrate/", "/docker-entrypoint-initdb.d/")
1615
.Build();
1716
}

examples/WeatherForecast/Directory.Packages.props

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
55
</PropertyGroup>
66
<ItemGroup>
7-
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="8.0.13"/>
8-
<PackageVersion Include="Microsoft.Fast.Components.FluentUI" Version="3.5.5"/>
9-
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.11"/>
7+
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="10.0.1"/>
8+
<PackageVersion Include="Microsoft.Fast.Components.FluentUI" Version="3.8.0"/>
9+
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.0"/>
1010
<!-- Unit and integration test dependencies: -->
1111
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1"/>
12-
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.13"/>
13-
<PackageVersion Include="Testcontainers.PostgreSql" Version="4.7.0"/>
12+
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.1"/>
13+
<PackageVersion Include="Testcontainers.PostgreSql" Version="4.10.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/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ RUN dotnet restore $CSPROJ_FILE_PATH
1010

1111
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
1212

13-
FROM mcr.microsoft.com/dotnet/aspnet:8.0
13+
FROM mcr.microsoft.com/dotnet/aspnet:10.0
1414
ARG RESOURCE_REAPER_SESSION_ID="00000000-0000-0000-0000-000000000000"
1515
LABEL "org.testcontainers.resource-reaper-session"=$RESOURCE_REAPER_SESSION_ID
1616
WORKDIR /app

examples/WeatherForecast/src/WeatherForecast/DatabaseContainer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ namespace WeatherForecast;
22

33
public sealed class DatabaseContainer : IHostedService
44
{
5-
private readonly PostgreSqlContainer _postgreSqlContainer = new PostgreSqlBuilder().Build();
5+
private readonly PostgreSqlContainer _postgreSqlContainer = new PostgreSqlBuilder("postgres:15.1").Build();
66

77
public Task StartAsync(CancellationToken cancellationToken)
88
{

examples/WeatherForecast/tests/WeatherForecast.InProcess.Tests/WeatherForecastTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ namespace WeatherForecast.InProcess.Tests;
33
[UsedImplicitly]
44
public sealed class WeatherForecastTest : IAsyncLifetime
55
{
6-
private readonly PostgreSqlContainer _postgreSqlContainer = new PostgreSqlBuilder().Build();
6+
private readonly PostgreSqlContainer _postgreSqlContainer = new PostgreSqlBuilder("postgres:15.1").Build();
77

88
public Task InitializeAsync()
99
{

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ namespace WeatherForecast.Tests;
33
[UsedImplicitly]
44
public sealed class WeatherForecastContainer : HttpClient, IAsyncLifetime
55
{
6-
private static readonly X509Certificate Certificate = new X509Certificate2(WeatherForecastImage.CertificateFilePath, WeatherForecastImage.CertificatePassword);
6+
private static readonly X509Certificate Certificate = X509CertificateLoader.LoadPkcs12FromFile(WeatherForecastImage.CertificateFilePath, WeatherForecastImage.CertificatePassword);
77

88
private static readonly WeatherForecastImage Image = new WeatherForecastImage();
99

@@ -27,13 +27,12 @@ public WeatherForecastContainer()
2727
_weatherForecastNetwork = new NetworkBuilder()
2828
.Build();
2929

30-
_postgreSqlContainer = new PostgreSqlBuilder()
30+
_postgreSqlContainer = new PostgreSqlBuilder("postgres:15.1")
3131
.WithNetwork(_weatherForecastNetwork)
3232
.WithNetworkAliases(weatherForecastStorage)
3333
.Build();
3434

35-
_weatherForecastContainer = new ContainerBuilder()
36-
.WithImage(Image)
35+
_weatherForecastContainer = new ContainerBuilder(Image)
3736
.WithNetwork(_weatherForecastNetwork)
3837
.WithPortBinding(WeatherForecastImage.HttpsPort, true)
3938
.WithEnvironment("ASPNETCORE_URLS", "https://+")

examples/WeatherForecast/tests/WeatherForecast.Tests/WeatherForecastImage.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ public sealed class WeatherForecastImage : IImage, IAsyncLifetime
2121

2222
public string Digest => _image.Digest;
2323

24+
public string Platform => _image.Platform;
25+
2426
public string FullName => _image.FullName;
2527

2628
public async Task InitializeAsync()

0 commit comments

Comments
 (0)