-
-
Notifications
You must be signed in to change notification settings - Fork 499
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
[Bug]: CopyDirToContainer doesn't behave as expected #2780
Labels
bug
An issue with the library
Comments
This means that |
stevenh
added a commit
that referenced
this issue
Sep 16, 2024
Add CopyHostPathTo to container methods, which is capable of copying files and directories from the host to a container. It identifies the correct copy semantics based on inspecting the source and target, replicating the behaviour of docker cp and other OS copy tools. This deprecates CopyDirToContainer and CopyFileToContainer while still correcting their behaviour to also match docker cp behaviour. Replace nonamedreturns linter with nakedret, as nonamedreturns prevents naming returned parameters which has a number of valid uses including: disambiguating return values and error checking. Copying files to the container now doesn't compression as this is slower and consumes more resources for the typical local transfer case. Fix docker copy tests to they validate the correct behaviour by ensuring that done is reported to the container log. Clean up some error wrapping. Fixes #2780
stevenh
added a commit
that referenced
this issue
Sep 16, 2024
Add CopyHostPathTo to container methods, which is capable of copying files and directories from the host to a container. It identifies the correct copy semantics based on inspecting the source and target, replicating the behaviour of docker cp and other OS copy tools. This deprecates CopyDirToContainer and CopyFileToContainer while still correcting their behaviour to also match docker cp behaviour. Replace nonamedreturns linter with nakedret, as nonamedreturns prevents naming returned parameters which has a number of valid uses including: disambiguating return values and error checking. Copying files to the container now doesn't compression as this is slower and consumes more resources for the typical local transfer case. Fix docker copy tests to they validate the correct behaviour by ensuring that done is reported to the container log. Clean up some error wrapping. Fixes #2780
stevenh
added a commit
that referenced
this issue
Sep 16, 2024
Add CopyHostPathTo to container methods, which is capable of copying files and directories from the host to a container. It identifies the correct copy semantics based on inspecting the source and target, replicating the behaviour of docker cp and other OS copy tools. This deprecates CopyDirToContainer and CopyFileToContainer while still correcting their behaviour to also match docker cp behaviour. Replace nonamedreturns linter with nakedret, as nonamedreturns prevents naming returned parameters which has a number of valid uses including: disambiguating return values and error checking. Copying files to the container now doesn't compression as this is slower and consumes more resources for the typical local transfer case. Fix docker copy tests to they validate the correct behaviour by ensuring that done is reported to the container log. Clean up some error wrapping. Fix testdata wait scripts. Fix invalid FileMode values, so tests don't fail with the new FileMode validation. Switch to exists check for copy instead of running it as a shell. Fixes #2780
stevenh
added a commit
that referenced
this issue
Sep 16, 2024
Add CopyHostPathTo to container methods, which is capable of copying files and directories from the host to a container. It identifies the correct copy semantics based on inspecting the source and target, replicating the behaviour of docker cp and other OS copy tools. This deprecates CopyDirToContainer and CopyFileToContainer while still correcting their behaviour to also match docker cp behaviour. Replace nonamedreturns linter with nakedret, as nonamedreturns prevents naming returned parameters which has a number of valid uses including: disambiguating return values and error checking. Copying files to the container now doesn't compression as this is slower and consumes more resources for the typical local transfer case. Fix docker copy tests to they validate the correct behaviour by ensuring that done is reported to the container log. Clean up some error wrapping. Fix testdata wait scripts. Fix invalid FileMode values, so tests don't fail with the new FileMode validation. Switch to exists check for copy instead of running it as a shell. Fixes #2780
stevenh
added a commit
that referenced
this issue
Sep 17, 2024
Add CopyHostPathTo to container methods, which is capable of copying files and directories from the host to a container. It identifies the correct copy semantics based on inspecting the source and target, replicating the behaviour of docker cp and other OS copy tools. This deprecates CopyDirToContainer and CopyFileToContainer while still correcting their behaviour to also match docker cp behaviour. Replace nonamedreturns linter with nakedret, as nonamedreturns prevents naming returned parameters which has a number of valid uses including: disambiguating return values and error checking. Copying files to the container now doesn't compression as this is slower and consumes more resources for the typical local transfer case. Fix docker copy tests to they validate the correct behaviour by ensuring that done is reported to the container log. Clean up some error wrapping. Fix testdata wait scripts. Fix invalid FileMode values, so tests don't fail with the new FileMode validation. Switch to exists check for copy instead of running it as a shell. Fixes #2780
stevenh
added a commit
that referenced
this issue
Sep 17, 2024
Add CopyHostPathTo to container methods, which is capable of copying files and directories from the host to a container. It identifies the correct copy semantics based on inspecting the source and target, replicating the behaviour of docker cp and other OS copy tools. This deprecates CopyDirToContainer and CopyFileToContainer while still correcting their behaviour to also match docker cp behaviour. Replace nonamedreturns linter with nakedret, as nonamedreturns prevents naming returned parameters which has a number of valid uses including: disambiguating return values and error checking. Copying files to the container now doesn't compression as this is slower and consumes more resources for the typical local transfer case. Fix docker copy tests to they validate the correct behaviour by ensuring that done is reported to the container log. Clean up some error wrapping. Fix testdata wait scripts. Fix invalid FileMode values, so tests don't fail with the new FileMode validation. Switch to exists check for copy instead of running it as a shell. Fixes #2780
stevenh
added a commit
that referenced
this issue
Sep 17, 2024
Add CopyHostPathTo to container methods, which is capable of copying files and directories from the host to a container. It identifies the correct copy semantics based on inspecting the source and target, replicating the behaviour of docker cp and other OS copy tools. This deprecates CopyDirToContainer and CopyFileToContainer while still correcting their behaviour to also match docker cp behaviour. Replace nonamedreturns linter with nakedret, as nonamedreturns prevents naming returned parameters which has a number of valid uses including: disambiguating return values and error checking. Copying files to the container now doesn't compression as this is slower and consumes more resources for the typical local transfer case. Fix docker copy tests to they validate the correct behaviour by ensuring that done is reported to the container log. Clean up some error wrapping. Fix testdata wait scripts. Fix invalid FileMode values, so tests don't fail with the new FileMode validation. Switch to exists check for copy instead of running it as a shell. Disable linter check for deprecated methods as we use them internally and test them. Fixes #2780
stevenh
added a commit
that referenced
this issue
Sep 17, 2024
Add CopyHostPathTo to container methods, which is capable of copying files and directories from the host to a container. It identifies the correct copy semantics based on inspecting the source and target, replicating the behaviour of docker cp and other OS copy tools. This deprecates CopyDirToContainer and CopyFileToContainer while still correcting their behaviour to also match docker cp behaviour. Replace nonamedreturns linter with nakedret, as nonamedreturns prevents naming returned parameters which has a number of valid uses including: disambiguating return values and error checking. Copying files to the container now doesn't compression as this is slower and consumes more resources for the typical local transfer case. Fix docker copy tests to they validate the correct behaviour by ensuring that done is reported to the container log. Clean up some error wrapping. Fix testdata wait scripts. Fix invalid FileMode values, so tests don't fail with the new FileMode validation. Switch to exists check for copy instead of running it as a shell. Disable linter check for deprecated methods as we use them internally and test them. Fixes #2780
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Testcontainers version
0.33
Using the latest Testcontainers version?
Yes
Host OS
Linux
Host arch
amd64
Go version
1.23.1
Docker version
Docker info
What happened?
Calling
CopyDirToContainer
withhostDirPath
that is a host directory and acontainerParentPath
that container directory the contents ofhostDirPath
was copied to the parent ofcontainerParentPath
instead of the path itself.For example:
This resulted in
testdata
in the root directory of the container.I would expect this to match
docker cp
behaviour so if/scripts
didn't exist the contents oftestdata
would be copied into the container creating/scripts
. If the directory does exist it should copy it into the/scripts
resulting in/scripts/testdata
.In addition to this the fileMode parameter overrides the permission of all files within the source when copied, with no option to preserve source permissions, which is frustrating.
Relevant log output
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: