X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/7af0535d3b0d7960152b06b7211c26bfd7b208cb..42c20b25e1325124b88e3b9b285544dc41122b56:/sdk/python/tests/test_arv_put.py diff --git a/sdk/python/tests/test_arv_put.py b/sdk/python/tests/test_arv_put.py index 2a71f3671a..0e531dee31 100644 --- a/sdk/python/tests/test_arv_put.py +++ b/sdk/python/tests/test_arv_put.py @@ -14,10 +14,10 @@ from functools import partial import apiclient import ciso8601 import datetime -import hashlib import json import logging import mock +import multiprocessing import os import pwd import random @@ -31,7 +31,6 @@ import tempfile import time import unittest import uuid -import yaml import arvados import arvados.commands.put as arv_put @@ -294,6 +293,26 @@ class ArvPutUploadJobTest(run_test_server.TestCaseWithServers, shutil.rmtree(self.small_files_dir) shutil.rmtree(self.tempdir_with_symlink) + def test_non_regular_files_are_ignored_except_symlinks_to_dirs(self): + def pfunc(x): + with open(x, 'w') as f: + f.write('test') + fifo_filename = 'fifo-file' + fifo_path = os.path.join(self.tempdir_with_symlink, fifo_filename) + self.assertTrue(os.path.islink(os.path.join(self.tempdir_with_symlink, 'linkeddir'))) + os.mkfifo(fifo_path) + producer = multiprocessing.Process(target=pfunc, args=(fifo_path,)) + producer.start() + cwriter = arv_put.ArvPutUploadJob([self.tempdir_with_symlink]) + cwriter.start(save_collection=False) + if producer.exitcode is None: + # If the producer is still running, kill it. This should always be + # before any assertion that may fail. + producer.terminate() + producer.join(1) + self.assertIn('linkeddir', cwriter.manifest_text()) + self.assertNotIn(fifo_filename, cwriter.manifest_text()) + def test_symlinks_are_followed_by_default(self): self.assertTrue(os.path.islink(os.path.join(self.tempdir_with_symlink, 'linkeddir'))) self.assertTrue(os.path.islink(os.path.join(self.tempdir_with_symlink, 'linkedfile')))