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.73k stars 262 forks source link

feat: Use Docker's inspect API to get resource information #1018

Closed HofmeisterAn closed 11 months ago

HofmeisterAn commented 11 months ago

What does this PR do?

The pull request replaces the list resource API calls with the inspect API call.

Why is it important?

This simplifies the internal Testcontainers' API. In addition, it reduces the number of operations and might result in slight performance improvements. Furthermore, the pull image policy callback will contain additional information to determine whether Testcontainers should pull an image or not.

The container and image builder members WithImagePullPolicy and WithImageBuildPolicy received a callback argument of type ImagesListResponse. We updated these callbacks, they will now receive an argument of type ImageInspectResponse. This change has been made to provide more detailed information about the actual cached image.

Related issues

-

Follow-ups

Testcontainers currently pre-pulls images before building an image from a Dockerfile. Right now, Testcontainers always attempts to pull base images, even if they already exist on the Docker host. After this pull request, we will be able to skip pre-pulling images for those that already exist locally.

netlify[bot] commented 11 months ago

Deploy Preview for testcontainers-dotnet ready!

Name Link
Latest commit b0b0acbf57ac152cf8a10d93a83ea6480b0a11f8
Latest deploy log https://app.netlify.com/sites/testcontainers-dotnet/deploys/65258b2daf99d70008ed43af
Deploy Preview https://deploy-preview-1018--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.