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 278 forks source link

Improve error reporting when loading the Docker configuration file #1263

Open 0xced opened 2 months ago

0xced commented 2 months ago

What does this PR do?

This pull request improves error handling while reading the Docker context configuration file. It throws a new DockerConfigurationException instead of silently failing.

Also, since GetCurrentEndpoint() can't return null anymore there's no need to try the default GetSocketPathFromHomeDesktopDir() and GetSocketPathFromHomeRunDir() socket paths.

Why is it important?

Silently returning null instead of throwing proper exceptions makes it harder to diagnose issues.

Related issues

How to test this PR

The DockerConfigTests were updated and a new ThrowsWhenDockerConfigEndpointNotFound test was added.

netlify[bot] commented 2 months ago

Deploy Preview for testcontainers-dotnet ready!

Name Link
Latest commit 3a0cac8cf9c382d808462c9145099f36590a88ce
Latest deploy log https://app.netlify.com/sites/testcontainers-dotnet/deploys/674501aef7ce880008114362
Deploy Preview https://deploy-preview-1263--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.