[ARVADOS] updated: ccdb53bf1ea5067edbbbbe71ecb89425bafa86b1
git at public.curoverse.com
git at public.curoverse.com
Tue Oct 6 17:01:20 EDT 2015
Summary of changes:
sdk/python/tests/test_arv_put.py | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
via ccdb53bf1ea5067edbbbbe71ecb89425bafa86b1 (commit)
from 8325a8860ac6c758e6c8005b4e31fa95a9412992 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit ccdb53bf1ea5067edbbbbe71ecb89425bafa86b1
Author: Tom Clegg <tom at curoverse.com>
Date: Tue Oct 6 17:10:28 2015 -0400
7254: Test that replication arg is passed through to KeepClient.put()
diff --git a/sdk/python/tests/test_arv_put.py b/sdk/python/tests/test_arv_put.py
index f4bd8b6..debbd54 100644
--- a/sdk/python/tests/test_arv_put.py
+++ b/sdk/python/tests/test_arv_put.py
@@ -2,6 +2,7 @@
# -*- coding: utf-8 -*-
import apiclient
+import mock
import os
import pwd
import re
@@ -335,10 +336,10 @@ class ArvadosPutTest(run_test_server.TestCaseWithServers, ArvadosBaseTestCase):
self.main_stderr = StringIO()
return arv_put.main(args, self.main_stdout, self.main_stderr)
- def call_main_on_test_file(self):
+ def call_main_on_test_file(self, args=[]):
with self.make_test_file() as testfile:
path = testfile.name
- self.call_main_with_args(['--stream', '--no-progress', path])
+ self.call_main_with_args(['--stream', '--no-progress'] + args + [path])
self.assertTrue(
os.path.exists(os.path.join(os.environ['KEEP_LOCAL_STORE'],
'098f6bcd4621d373cade4e832627b4f6')),
@@ -381,6 +382,22 @@ class ArvadosPutTest(run_test_server.TestCaseWithServers, ArvadosBaseTestCase):
arv_put.ResumeCache.CACHE_DIR = orig_cachedir
os.chmod(cachedir, 0o700)
+ def test_put_block_replication(self):
+ with mock.patch('arvados.collection.KeepClient.local_store_put') as put_mock:
+ put_mock.return_value = 'acbd18db4cc2f85cedef654fccc4a4d8+3'
+ orig_cachedir = arv_put.ResumeCache.CACHE_DIR
+ cachedir = self.make_tmpdir()
+ arv_put.ResumeCache.CACHE_DIR = os.path.join(cachedir, 'cachedir')
+ try:
+ self.call_main_on_test_file(['--replication', '1'])
+ self.call_main_on_test_file(['--replication', '4'])
+ self.call_main_on_test_file(['--replication', '5'])
+ finally:
+ arv_put.ResumeCache.CACHE_DIR = orig_cachedir
+ self.assertEqual(
+ [x[len(x)-1].get('copies') for x in put_mock.call_args_list],
+ [1, 4, 5])
+
def test_normalize(self):
testfile1 = self.make_test_file()
testfile2 = self.make_test_file()
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list