Skip to content
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

feat: Add URL-based resource mapping container builder API #1118

Merged
merged 3 commits into from
Feb 17, 2024

Conversation

0xced
Copy link
Contributor

@0xced 0xced commented Feb 14, 2024

What does this PR do?

This pull request introduces a new URL-based resource mapping, allowing to easily copying a file accessible over HTTP or HTTPS directly into a container before it starts, just like one could copy a local file.

Why is it important?

The UriResourceMapping is straightforward to write and would not need to be included in the Testcontainers library but I think having it built-in is a nice addition.

Copy link

netlify bot commented Feb 14, 2024

Deploy Preview for testcontainers-dotnet ready!

Name Link
🔨 Latest commit 5516086
🔍 Latest deploy log https://app.netlify.com/sites/testcontainers-dotnet/deploys/65d0ad90c34381000801338a
😎 Deploy Preview https://deploy-preview-1118--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.

HofmeisterAn
HofmeisterAn previously approved these changes Feb 17, 2024
Copy link
Collaborator

@HofmeisterAn HofmeisterAn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! The PR looks good, and I think it is a nice enhancement. I have added additional tests to cover the implementation of UriResourceMapping as well. While adding the tests, I noticed a minor misunderstanding. The WithResourceMapping(string, string, UnixFileModes) always copies files to the target directory path, never to a file path. If you want to copy a file to a particular target file path, you need to use the overload WithResourceMapping(FileInfo, FileInfo, UnixFileModes) (this was necessary due to backward compatibility). I updated the docs and tried to explain the behavior better. I will merge it later. Thanks again.

@HofmeisterAn HofmeisterAn changed the title feat: Introduce a new URL-based resource mapping feat: Add URL-based resource mapping container builder API Feb 17, 2024
@HofmeisterAn HofmeisterAn added the enhancement New feature or request label Feb 17, 2024
@HofmeisterAn HofmeisterAn merged commit a21b6e1 into testcontainers:develop Feb 17, 2024
11 checks passed
@0xced 0xced deleted the feature/UriResourceMapping branch February 17, 2024 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants