Skip to content

Commit

Permalink
try expanding rclone call
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyCBakerPhD committed Jul 1, 2024
1 parent b0d5633 commit 915fa06
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dockerfiles/rclone_with_config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM rclone/rclone:latest
LABEL org.opencontainers.image.source=https://github.com/catalystneuro/neuroconv
LABEL org.opencontainers.image.description="A simple extension of the basic Rclone docker image to automatically create a local .conf file from contents passed via an environment variable."
CMD printf "$RCLONE_CONFIG" > ./rclone.conf && echo "$(pwd)" && cat ./rclone.conf && $RCLONE_COMMANNDS
CMD printf "$RCLONE_CONFIG" > ./rclone.conf && echo "$(pwd)" && cat ./rclone.conf && rclone $RCLONE_COMMANNDS
ENTRYPOINT [""]
11 changes: 7 additions & 4 deletions tests/docker_rclone_with_config_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def test_rclone_with_config(self):

os.environ["RCLONE_CONFIG"] = rclone_config_file_stream
os.environ["RCLONE_COMMAND"] = (
f"rclone copy test_google_drive_remote:testing_rclone_with_config {self.test_folder} --verbose --progress"
f"copy test_google_drive_remote:testing_rclone_with_config {self.test_folder} --verbose --progress"
)

output = deploy_process(
Expand All @@ -80,11 +80,14 @@ def test_rclone_with_config(self):
# The .conf file created inside the container should not be viewable outside the running container
# (it was not saved to mounted location)

print(list(self.test_folder.iterdir()))
test_folder_contents_after_call = list(self.test_folder.iterdir())
assert len(test_folder_contents_after_call) != 0, f"Test folder {self.test_folder} is empty!"

testing_file_path = self.test_folder / "testing_rclone_with_config" / "ci_tests" / "test_text_file.txt"
assert testing_file_path.is_file()
assert testing_file_path.is_file(), "The specific test transfer file does not exist!"

with open(file=testing_file_path, mode="r") as io:
file_content = io.read()
assert file_content == "This is a test file for the Rclone (with config) docker image hosted on NeuroConv!"
assert (
file_content == "This is a test file for the Rclone (with config) docker image hosted on NeuroConv!"
), "The file content does not match expectations!"

0 comments on commit 915fa06

Please sign in to comment.