mirror of
https://github.com/ceph/s3-tests.git
synced 2024-11-22 09:29:43 +00:00
Moving region_sync to utils
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>
This commit is contained in:
parent
d0ad2aad20
commit
5c81151247
2 changed files with 20 additions and 13 deletions
|
@ -31,6 +31,7 @@ from nose.plugins.attrib import attr
|
||||||
from nose.plugins.skip import SkipTest
|
from nose.plugins.skip import SkipTest
|
||||||
|
|
||||||
from .utils import assert_raises
|
from .utils import assert_raises
|
||||||
|
from .utils import region_sync_meta
|
||||||
import AnonymousAuth
|
import AnonymousAuth
|
||||||
|
|
||||||
from email.header import decode_header
|
from email.header import decode_header
|
||||||
|
@ -4611,19 +4612,6 @@ def test_region_bucket_create_secondary_access_remove_master():
|
||||||
|
|
||||||
conn.delete_bucket(bucket)
|
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(resource='bucket')
|
||||||
@attr(method='get')
|
@attr(method='get')
|
||||||
@attr(operation='create on one region, access in another')
|
@attr(operation='create on one region, access in another')
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
import requests
|
||||||
|
import time
|
||||||
|
|
||||||
|
from nose.tools import eq_ as eq
|
||||||
|
|
||||||
def assert_raises(excClass, callableObj, *args, **kwargs):
|
def assert_raises(excClass, callableObj, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
Like unittest.TestCase.assertRaises, but returns the exception.
|
Like unittest.TestCase.assertRaises, but returns the exception.
|
||||||
|
@ -12,3 +17,17 @@ def assert_raises(excClass, callableObj, *args, **kwargs):
|
||||||
else:
|
else:
|
||||||
excName = str(excClass)
|
excName = str(excClass)
|
||||||
raise AssertionError("%s not raised" % excName)
|
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)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue