11579: Added assertion on test to check for file symlinks to be copied by default.
authorLucas Di Pentima <lucas@curoverse.com>
Tue, 2 May 2017 14:52:44 +0000 (11:52 -0300)
committerLucas Di Pentima <lucas@curoverse.com>
Tue, 2 May 2017 14:52:44 +0000 (11:52 -0300)
Don't treat a PathDoesNotExist exception as an abnormal termination, just log the proper error message, and quit.

sdk/python/arvados/commands/put.py
sdk/python/tests/test_arv_put.py

index ddc261f00f65dc677660c57ee4d4170c0dc3413c..6836d803886291a57dcc39b34c3dcb2c96a8c515 100644 (file)
@@ -474,7 +474,10 @@ class ArvPutUploadJob(object):
             # Note: We're expecting SystemExit instead of KeyboardInterrupt because
             #   we have a custom signal handler in place that raises SystemExit with
             #   the catched signal's code.
-            if not isinstance(e, SystemExit) or e.code != -2:
+            if isinstance(e, PathDoesNotExistError):
+                # We aren't interested in the traceback for this case
+                pass
+            elif not isinstance(e, SystemExit) or e.code != -2:
                 self.logger.warning("Abnormal termination:\n{}".format(traceback.format_exc(e)))
             raise
         finally:
@@ -985,7 +988,7 @@ def main(arguments=None, stdout=sys.stdout, stderr=sys.stderr):
     except PathDoesNotExistError as error:
         logger.error("\n".join([
             "arv-put: %s" % str(error)]))
-        exit(1)
+        sys.exit(1)
 
     if args.progress:  # Print newline to split stderr from stdout for humans.
         logger.info("\n")
index 2d17cb8cadde360452bf01fa64ff429fe9dc873a..320189104ab555dc97be4c618e83adc8d6acdd7f 100644 (file)
@@ -286,6 +286,7 @@ class ArvPutUploadJobTest(run_test_server.TestCaseWithServers,
         cwriter = arv_put.ArvPutUploadJob([self.tempdir_with_symlink])
         cwriter.start(save_collection=False)
         self.assertIn('linkeddir', cwriter.manifest_text())
+        self.assertIn('linkedfile', cwriter.manifest_text())
         cwriter.destroy_cache()
 
     def test_symlinks_are_not_followed_when_requested(self):