diff --git a/examples/Flyway/Directory.Packages.props b/examples/Flyway/Directory.Packages.props index 0d6465cd5..0bc4e83b6 100644 --- a/examples/Flyway/Directory.Packages.props +++ b/examples/Flyway/Directory.Packages.props @@ -6,7 +6,7 @@ - + diff --git a/examples/Flyway/tests/Flyway.Tests/DbFixture.cs b/examples/Flyway/tests/Flyway.Tests/DbFixture.cs index 7359c0350..e54390823 100644 --- a/examples/Flyway/tests/Flyway.Tests/DbFixture.cs +++ b/examples/Flyway/tests/Flyway.Tests/DbFixture.cs @@ -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(); @@ -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) @@ -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(); } diff --git a/examples/Respawn/Directory.Packages.props b/examples/Respawn/Directory.Packages.props index 76d4eec9b..b73d0da3d 100644 --- a/examples/Respawn/Directory.Packages.props +++ b/examples/Respawn/Directory.Packages.props @@ -6,11 +6,11 @@ - + - + \ No newline at end of file diff --git a/examples/Respawn/tests/Respawn.Tests/DbFixture.cs b/examples/Respawn/tests/Respawn.Tests/DbFixture.cs index f381a6129..754235d32 100644 --- a/examples/Respawn/tests/Respawn.Tests/DbFixture.cs +++ b/examples/Respawn/tests/Respawn.Tests/DbFixture.cs @@ -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(); } diff --git a/examples/WeatherForecast/Directory.Packages.props b/examples/WeatherForecast/Directory.Packages.props index cfaa30b42..0a1e6c60f 100644 --- a/examples/WeatherForecast/Directory.Packages.props +++ b/examples/WeatherForecast/Directory.Packages.props @@ -4,13 +4,13 @@ true - - - + + + - - + + diff --git a/examples/WeatherForecast/Dockerfile b/examples/WeatherForecast/Dockerfile index 4c6e92fd2..645ee5b9c 100644 --- a/examples/WeatherForecast/Dockerfile +++ b/examples/WeatherForecast/Dockerfile @@ -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 diff --git a/examples/WeatherForecast/src/WeatherForecast/DatabaseContainer.cs b/examples/WeatherForecast/src/WeatherForecast/DatabaseContainer.cs index 234998335..532e3f14a 100644 --- a/examples/WeatherForecast/src/WeatherForecast/DatabaseContainer.cs +++ b/examples/WeatherForecast/src/WeatherForecast/DatabaseContainer.cs @@ -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(); public Task StartAsync(CancellationToken cancellationToken) { diff --git a/examples/WeatherForecast/tests/WeatherForecast.InProcess.Tests/WeatherForecastTest.cs b/examples/WeatherForecast/tests/WeatherForecast.InProcess.Tests/WeatherForecastTest.cs index d41a4c80c..c88a3e362 100644 --- a/examples/WeatherForecast/tests/WeatherForecast.InProcess.Tests/WeatherForecastTest.cs +++ b/examples/WeatherForecast/tests/WeatherForecast.InProcess.Tests/WeatherForecastTest.cs @@ -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() { diff --git a/examples/WeatherForecast/tests/WeatherForecast.Tests/WeatherForecastContainer.cs b/examples/WeatherForecast/tests/WeatherForecast.Tests/WeatherForecastContainer.cs index 22030a11a..920ec4f6d 100644 --- a/examples/WeatherForecast/tests/WeatherForecast.Tests/WeatherForecastContainer.cs +++ b/examples/WeatherForecast/tests/WeatherForecast.Tests/WeatherForecastContainer.cs @@ -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(); @@ -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://+") diff --git a/examples/WeatherForecast/tests/WeatherForecast.Tests/WeatherForecastImage.cs b/examples/WeatherForecast/tests/WeatherForecast.Tests/WeatherForecastImage.cs index e6c132c38..54dc2c045 100644 --- a/examples/WeatherForecast/tests/WeatherForecast.Tests/WeatherForecastImage.cs +++ b/examples/WeatherForecast/tests/WeatherForecast.Tests/WeatherForecastImage.cs @@ -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()