[ARVADOS] updated: 290247250e0c5702a341f98dfdc380e29f1b45c7

git at public.curoverse.com git at public.curoverse.com
Mon Oct 5 17:23:58 EDT 2015


Summary of changes:
 sdk/python/tests/run_test_server.py |  7 +++---
 tools/keep-rsync/keep-rsync_test.go | 44 +++++++++++++++++++++++++++----------
 2 files changed, 37 insertions(+), 14 deletions(-)

       via  290247250e0c5702a341f98dfdc380e29f1b45c7 (commit)
      from  f3b5ffc2a4409d4c1b676e40ba4e582ca2beeb61 (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 290247250e0c5702a341f98dfdc380e29f1b45c7
Author: radhika <radhika at curoverse.com>
Date:   Mon Oct 5 17:22:37 2015 -0400

    7167: Update test to also put a block in dst and attempt get from src.

diff --git a/sdk/python/tests/run_test_server.py b/sdk/python/tests/run_test_server.py
index 62a2a82..fba9bb6 100644
--- a/sdk/python/tests/run_test_server.py
+++ b/sdk/python/tests/run_test_server.py
@@ -353,9 +353,11 @@ def run_keep(blob_signing_key=None, enforce_permissions=False):
         api.keep_disks().delete(uuid=d['uuid']).execute()
 
     start_index = 0
+    end_index = 2
     if keep_existing is not None:
         start_index = 2
-    for d in range(start_index, start_index+2):
+        end_index = 3
+    for d in range(start_index, end_index):
         port = _start_keep(d, keep_args)
         svc = api.keep_services().create(body={'keep_service': {
             'uuid': 'zzzzz-bi6l4-keepdisk{:07d}'.format(d),
@@ -380,9 +382,8 @@ def _stop_keep(n):
 def stop_keep():
     _stop_keep(0)
     _stop_keep(1)
-    # We may have created 2 additional keep servers when keep_existing is used
+    # We may have created an additional keep servers when keep_existing is used
     _stop_keep(2)
-    _stop_keep(3)
 
 def run_keep_proxy():
     if 'ARVADOS_TEST_PROXY_SERVICES' in os.environ:
diff --git a/tools/keep-rsync/keep-rsync_test.go b/tools/keep-rsync/keep-rsync_test.go
index 7636c2e..97db571 100644
--- a/tools/keep-rsync/keep-rsync_test.go
+++ b/tools/keep-rsync/keep-rsync_test.go
@@ -68,6 +68,7 @@ func setupRsync(c *C) {
 	// load kcDst
 	kcDst, err = keepclient.MakeKeepClient(&arvDst)
 	c.Assert(err, Equals, nil)
+	kcDst.Want_replicas = 1
 }
 
 // Test readConfigFromFile method
@@ -94,27 +95,48 @@ func (s *ServerRequiredSuite) TestReadConfigFromFile(c *C) {
 
 // Test keep-rsync initialization, with src and dst keep servers.
 // Do a Put and Get in src, both of which should succeed.
-// Do a Get in dst for the same hash, which should raise block not found error.
-func (s *ServerRequiredSuite) TestRsyncPutInSrc_GetFromDstShouldFail(c *C) {
+// Do a Put and Get in dst, both of which should succeed.
+// Do a Get in dst for the src hash, which should raise block not found error.
+// Do a Get in src for the dst hash, which should raise block not found error.
+func (s *ServerRequiredSuite) TestRsyncPutInOne_GetFromOtherShouldFail(c *C) {
 	setupRsync(c)
 
 	// Put a block in src using kcSrc and Get it
-	data := []byte("test-data")
-	hash := fmt.Sprintf("%x", md5.Sum(data))
+	srcData := []byte("test-data1")
+	locatorInSrc := fmt.Sprintf("%x", md5.Sum(srcData))
 
-	hash2, rep, err := kcSrc.PutB(data)
-	c.Check(hash2, Matches, fmt.Sprintf(`^%s\+9(\+.+)?$`, hash))
+	hash, rep, err := kcSrc.PutB(srcData)
+	c.Check(hash, Matches, fmt.Sprintf(`^%s\+10(\+.+)?$`, locatorInSrc))
 	c.Check(rep, Equals, 2)
 	c.Check(err, Equals, nil)
 
-	reader, blocklen, _, err := kcSrc.Get(hash)
+	reader, blocklen, _, err := kcSrc.Get(locatorInSrc)
 	c.Assert(err, Equals, nil)
-	c.Check(blocklen, Equals, int64(9))
+	c.Check(blocklen, Equals, int64(10))
 	all, err := ioutil.ReadAll(reader)
-	c.Check(all, DeepEquals, data)
+	c.Check(all, DeepEquals, srcData)
 
-	// Get using kcDst should fail with NotFound error
-	_, _, _, err = kcDst.Get(hash)
+	// Put a different block in src using kcSrc and Get it
+	dstData := []byte("test-data2")
+	locatorInDst := fmt.Sprintf("%x", md5.Sum(dstData))
+
+	hash, rep, err = kcDst.PutB(dstData)
+	c.Check(hash, Matches, fmt.Sprintf(`^%s\+10(\+.+)?$`, locatorInDst))
+	c.Check(rep, Equals, 1)
+	c.Check(err, Equals, nil)
+
+	reader, blocklen, _, err = kcDst.Get(locatorInDst)
+	c.Assert(err, Equals, nil)
+	c.Check(blocklen, Equals, int64(10))
+	all, err = ioutil.ReadAll(reader)
+	c.Check(all, DeepEquals, dstData)
+
+	// Get srcLocator using kcDst should fail with NotFound error
+	_, _, _, err = kcDst.Get(locatorInSrc)
+	c.Assert(err.Error(), Equals, "Block not found")
+
+	// Get dstLocator using kcSrc should fail with NotFound error
+	_, _, _, err = kcSrc.Get(locatorInDst)
 	c.Assert(err.Error(), Equals, "Block not found")
 }
 

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list