-
-
Notifications
You must be signed in to change notification settings - Fork 341
chore: Update examples to use TC for .NET 4.10.0 #1616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for testcontainers-dotnet ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
WalkthroughThe changes upgrade dependency versions across example projects (Testcontainers, EntityFrameworkCore, AspNetCore) to newer releases, update Docker base images, and refactor builder constructors to accept image parameters directly rather than using parameterless constructors with chained Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (10)
examples/Flyway/Directory.Packages.propsexamples/Flyway/tests/Flyway.Tests/DbFixture.csexamples/Respawn/Directory.Packages.propsexamples/Respawn/tests/Respawn.Tests/DbFixture.csexamples/WeatherForecast/Directory.Packages.propsexamples/WeatherForecast/Dockerfileexamples/WeatherForecast/src/WeatherForecast/DatabaseContainer.csexamples/WeatherForecast/tests/WeatherForecast.InProcess.Tests/WeatherForecastTest.csexamples/WeatherForecast/tests/WeatherForecast.Tests/WeatherForecastContainer.csexamples/WeatherForecast/tests/WeatherForecast.Tests/WeatherForecastImage.cs
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: diegosasw
Repo: testcontainers/testcontainers-dotnet PR: 1583
File: src/Testcontainers.KurrentDb/Testcontainers.KurrentDb.csproj:7-7
Timestamp: 2025-11-17T17:58:43.958Z
Learning: In the testcontainers-dotnet repository, JetBrains.Annotations should use version 2023.3.0 to maintain consistency with the main Testcontainers csproj, rather than always using the latest available version.
📚 Learning: 2025-11-17T17:58:43.958Z
Learnt from: diegosasw
Repo: testcontainers/testcontainers-dotnet PR: 1583
File: src/Testcontainers.KurrentDb/Testcontainers.KurrentDb.csproj:7-7
Timestamp: 2025-11-17T17:58:43.958Z
Learning: In the testcontainers-dotnet repository, JetBrains.Annotations should use version 2023.3.0 to maintain consistency with the main Testcontainers csproj, rather than always using the latest available version.
Applied to files:
examples/Respawn/Directory.Packages.propsexamples/WeatherForecast/Directory.Packages.propsexamples/WeatherForecast/tests/WeatherForecast.InProcess.Tests/WeatherForecastTest.csexamples/Flyway/Directory.Packages.props
🔇 Additional comments (11)
examples/Respawn/Directory.Packages.props (2)
9-9: Testcontainers.PostgreSql update looks good.The version update aligns with the PR objectives.
14-14: No action required—Respawn v7.0.0 release notes do not list breaking changes compared to 6.2.1. The major version bump includes features and dependency updates but no documented breaking API changes.examples/WeatherForecast/Dockerfile (1)
13-13: .NET 10.0 is officially released and available from Microsoft..NET 10.0 was officially released on November 11, 2025, and is currently available from the Microsoft Container Registry. The Dockerfile's use of this version is appropriate and no longer a concern.
examples/Flyway/Directory.Packages.props (1)
9-9: Package version 4.10.0 is available and has no known security vulnerabilities.The Testcontainers.PostgreSql version is confirmed in the NuGet registry with no reported CVEs or advisories for this specific release.
examples/WeatherForecast/tests/WeatherForecast.Tests/WeatherForecastImage.cs (1)
24-25: Remove Platform property addition as it is not part of the IImage interface.The Platform property is not a required member of the IImage interface in Testcontainers for .NET 4.10.0. IImage exposes Registry, Repository, Name, Tag, Digest, and hostname resolver functionality—Platform is specific to the DockerImage implementation. Adding this property does not complete IImage implementation and suggests a misunderstanding of the interface contract.
Likely an incorrect or invalid review comment.
examples/Respawn/tests/Respawn.Tests/DbFixture.cs (1)
13-15: LGTM!The migration from
PostgreSqlBuilder().WithImage(...)toPostgreSqlBuilder("postgres:15-alpine")follows the updated Testcontainers API pattern and removes obsolete method chaining.examples/Flyway/tests/Flyway.Tests/DbFixture.cs (1)
22-25: LGTM!Good improvements:
- Both
PostgreSqlBuilderandContainerBuildernow use parameterized constructors with explicit image tags.- The addition of
-passwordcommand (line 36) ensures Flyway can authenticate with PostgreSQL using the default credentials.WaitStrategyMode.OneShotis appropriate for the Flyway container since it runs migrations once and exits.Also applies to: 32-42
examples/WeatherForecast/tests/WeatherForecast.InProcess.Tests/WeatherForecastTest.cs (1)
6-6: LGTM!The migration to the parameterized
PostgreSqlBuilder("postgres:15.1")constructor follows the updated API pattern. The use ofpostgres:15.1(specific version without Alpine) is consistent with other WeatherForecast examples in this PR.examples/WeatherForecast/tests/WeatherForecast.Tests/WeatherForecastContainer.cs (2)
6-6: Good modernization to useX509CertificateLoader.The switch from the deprecated
X509Certificate2constructor toX509CertificateLoader.LoadPkcs12FromFilealigns with .NET 9+ best practices where the file-loading constructors were marked obsolete.
30-43: LGTM!Both builder instantiations follow the updated API patterns:
PostgreSqlBuilder("postgres:15.1")uses the parameterized constructor.ContainerBuilder(Image)directly accepts theIImageinstance instead of chaining.WithImage().examples/WeatherForecast/Directory.Packages.props (1)
7-13: All package versions inDirectory.Packages.propsexist and are available on NuGet. The major version upgrades to 10.x for Entity Framework Core and related packages are consistent with the .NET 10 migration, and the pinned versions are stable and properly released.
What does this PR do?
This PR updates the .NET examples to the latest TC version (4.10.0) and removes obsolete API usage to follow best practices and serve as a good reference for using TC for .NET.
Why is it important?
-
Related issues
Summary by CodeRabbit
Chores
New Features
✏️ Tip: You can customize this high-level summary in your review settings.