@@ -186,21 +186,6 @@ def _assert_manifest_not_updated(self):
186186 for row in ManifestDownloadContext ._parse_manifest (self .manifest_file ):
187187 self .assertNotIn ('file_path' , row )
188188
189- def _assert_link_fails (self , num_logs , download_func , * args , ** kwargs ):
190- """Test that download_func(*args, **kwargs) fails to link num_logs times"""
191- os_error = OSError ()
192- os_error .errno = errno .EMLINK
193- for error in [os_error , ValueError (), RuntimeError ()]:
194- with self .subTest (error = error ):
195- with patch ('os.link' , side_effect = os_error ):
196- from hca .dss .util import log as log_
197- with self .assertLogs (logger = log_ , level = logging .WARNING ) as logs :
198- download_func (* args , ** kwargs )
199- for record in logs .records :
200- self .assertEqual (record .funcName , 'hardlink' )
201- self .assertEqual (record .msg , 'Failed to link source `%s` to destination `%s`; reverting to copying' )
202- self .assertEqual (len (logs .records ), num_logs )
203-
204189
205190class TestManifestDownloadFilestore (DSSClientTestCase ):
206191
@@ -358,12 +343,6 @@ def _assert_bundle_json(self, prefix=''):
358343 actual_hash = hashlib .sha256 (f .read ()).hexdigest ()
359344 self .assertEqual (actual_hash , expected_hash )
360345
361- @unittest .skipIf (os .name is 'nt' , 'os.link is not used on Windows' )
362- def test_link_fails (self ):
363- """If hardlinking fails, we should revert to copy"""
364- num_logs = 9 # 3 fake bundles with 3 data files each
365- self ._assert_link_fails (num_logs , self ._mock_download_manifest , self .manifest_file , 'aws' , layout = 'bundle' )
366-
367346 def test_download_dir_empty (self ):
368347 self ._test_download_dir ('' )
369348
@@ -498,11 +477,6 @@ def test_download_dir(self):
498477 def test_download_dir_dot_dir (self ):
499478 self ._test_download_dir (os .path .join ('.' , 'a_nested_dir' ))
500479
501- @unittest .skipIf (os .name is 'nt' , 'os.link is not used on Windows' )
502- def test_link_fails (self ):
503- num_logs = 5 # 4 files in bundle, + bundle manifest
504- self ._assert_link_fails (num_logs , self ._mock_download , 'any_bundle_uuid' , 'aws' )
505-
506480 @staticmethod
507481 def _fake_get_collection (collections ):
508482 """Used for mocking :meth:`hca.dss.DSSClient.get_collection`"""
0 commit comments