]> git-server-git.apps.pok.os.sepia.ceph.com Git - s3-tests.git/commitdiff
Moving region_sync to utils
authorJoe Buck <jbbuck@gmail.com>
Thu, 29 Aug 2013 22:37:15 +0000 (15:37 -0700)
committerJoe Buck <jbbuck@gmail.com>
Sat, 31 Aug 2013 05:13:42 +0000 (22:13 -0700)
Since other classes need to do syncs,
let's move it to the utils file.

Signed-off-by: Joe Buck <jbbuck@gmail.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
s3tests/functional/test_s3.py
s3tests/functional/utils.py

index 7747d71a13266c369a7bc368e4f021afdc06814c..c4f240bfcbd6e843d344098150eec14d5d9f1042 100644 (file)
@@ -31,6 +31,7 @@ from nose.plugins.attrib import attr
 from nose.plugins.skip import SkipTest
 
 from .utils import assert_raises
+from .utils import region_sync_meta
 import AnonymousAuth
 
 from email.header import decode_header
@@ -4611,19 +4612,6 @@ def test_region_bucket_create_secondary_access_remove_master():
 
         conn.delete_bucket(bucket)
 
-# syncs all the regions except for the one passed in
-def region_sync_meta(targets, region):
-
-    for (k, r) in targets.iteritems():
-        if r == region:
-            continue
-        conf = r.conf
-        if conf.sync_agent_addr:
-            ret = requests.post('http://{addr}:{port}/metadata/incremental'.format(addr = conf.sync_agent_addr, port = conf.sync_agent_port))
-            eq(ret.status_code, 200)
-        if conf.sync_meta_wait:
-            time.sleep(conf.sync_meta_wait)
-
 @attr(resource='bucket')
 @attr(method='get')
 @attr(operation='create on one region, access in another')
index 9398801a33a46f85d602f653507b6568f5cb1e80..8852cfaf1be733588b991c05a535a85154dde172 100644 (file)
@@ -1,3 +1,8 @@
+import requests
+import time
+
+from nose.tools import eq_ as eq
+
 def assert_raises(excClass, callableObj, *args, **kwargs):
     """
     Like unittest.TestCase.assertRaises, but returns the exception.
@@ -12,3 +17,17 @@ def assert_raises(excClass, callableObj, *args, **kwargs):
         else:
             excName = str(excClass)
         raise AssertionError("%s not raised" % excName)
+
+# syncs all the regions except for the one passed in
+def region_sync_meta(targets, region):
+
+    for (k, r) in targets.iteritems():
+        if r == region:
+            continue
+        conf = r.conf
+        if conf.sync_agent_addr:
+            ret = requests.post('http://{addr}:{port}/metadata/incremental'.format(addr = conf.sync_agent_addr, port = conf.sync_agent_port))
+            eq(ret.status_code, 200)
+        if conf.sync_meta_wait:
+            time.sleep(conf.sync_meta_wait)
+