testcontainers / testcontainers-dotnet

A library to support tests with throwaway instances of Docker containers for all compatible .NET Standard versions.
https://dotnet.testcontainers.org
MIT License
3.82k stars 279 forks source link

feat: Align `IImage` properties with Docker DSL #1256

Closed HofmeisterAn closed 2 months ago

HofmeisterAn commented 2 months ago

What does this PR do?

The PR updates the IImage and DockerImage implementations. It improves parsing and resolving the reference format, using parts of the official Go implementation. The table below shows the changes:

Actual Expected
Registry - myregistryhost:5000
Repository myregistryhost:5000/fedora fedora/httpd
Name httpd -
Tag version1.0 version1.0
Digest - sha256:37a3b014d320...
GetHostname() myregistryhost:5000 myregistryhost:5000

The Registry and Digest properties have been added to the interface. The Name property is marked obsolete and will be removed in the next minor version. The Repository property now resolves the correct value from the reference format according to the Docker DSL.

I’ve marked all obsolete parts and provided guidance on how to transition to the new interface. I tried to make the transition as smooth as possible, but relying on the Repository property might cause issues since it now resolves a different value than before.

Why is it important?

These changes align with other Testcontainers language implementations and address inconsistent APIs and incorrect DSL.

Related issues

netlify[bot] commented 2 months ago

Deploy Preview for testcontainers-dotnet ready!

Name Link
Latest commit 0e656aded7ea86dc2e53c7c9d0767793dc94de37
Latest deploy log https://app.netlify.com/sites/testcontainers-dotnet/deploys/66df3f6f07c0380008c73871
Deploy Preview https://deploy-preview-1256--testcontainers-dotnet.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.