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

chore: Exposed the internal endpoints for azurite #1004

Closed samtrion closed 9 months ago

samtrion commented 11 months ago

What does this PR do?

The service specific endpoints are provided, for free use.

Why is it important?

For better use within tests.

Related issues

None

netlify[bot] commented 11 months ago

Deploy Preview for testcontainers-dotnet ready!

Name Link
Latest commit db51bb017c24c0f11a706d1f04b9a70e40ae3e13
Latest deploy log https://app.netlify.com/sites/testcontainers-dotnet/deploys/652a5d85aa7cd200083d0bb2
Deploy Preview https://deploy-preview-1004--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.

samtrion commented 11 months ago

The BlobServiceClient or BlobContainerClient constructors (NuGet Package Azure.Storage.Blobs) has several overloads. Depending on the Authentication / Credential Method used, either the ConnectionString or the ServiceUrl is used.

https://learn.microsoft.com/en-us/dotnet/api/azure.storage.blobs.blobserviceclient.-ctor?view=azure-dotnet https://learn.microsoft.com/en-us/dotnet/api/azure.storage.blobs.blobcontainerclient.-ctor?view=azure-dotnet

samtrion commented 11 months ago

AzuriteBuilder now supports the possibility to store own account credentials. Furthermore, it is now possible to communicate with the container via https.

❗ It may still be necessary to call mkcert -install on the build agents before running the tests.

samtrion commented 11 months ago

❗ It may still be necessary to call mkcert -install on the build agents before running the tests.

I tried to adjust the pipeline, but there seems to be more dependencies to the mkcert local root CA than initially thought. I will try this further.

HofmeisterAn commented 11 months ago

❗ It may still be necessary to call mkcert -install on the build agents before running the tests.

I tried to adjust the pipeline, but there seems to be more dependencies to the mkcert local root CA than initially thought. I will try this further.

If it makes things easier, we can add the PEM files to the test repository for now and get the pull request to a proper state. We can sort it out later. Why don't you use openssl? We can generate the certificate during the CI run and store it where others can access it as well. Azureite won't be the last dependency that adds TLS support.

samtrion commented 11 months ago

Ok, reworked the PR. Created a certificate with OpenSSL in the tests directory and added it to the repository so we can reuse it.

openssl req -newkey rsa:2048 -x509 -nodes -keyout server.key -new -out server.cert -sha256 -days 99999 -addext "subjectAltName=IP:127.0.0.1" -subj "/C=CO/ST=ST/L=LO/O=OR/OU=OU/CN=CN"

Then uploaded the certificate locally to the certificate store and trusted it.

certutil -addstore -enterprise -f Root .\server.cert

As well as extended the pipeline to also trust the certificate on ubuntu based systems/runner. Unfortunately this does not seem to work as documented ... Here I would need support . 😞

HofmeisterAn commented 9 months ago

This pull request has been inactive for some time. I will close it for now. If you wish to continue working on it, please feel free to reopen it.