Make unit tests not require /etc/swift/*.ring.gz files
This commit is contained in:
parent
b072b61cdd
commit
7b38b9a19a
@ -934,7 +934,8 @@ class BaseApplication(object):
|
|||||||
|
|
||||||
log_name = 'base_application'
|
log_name = 'base_application'
|
||||||
|
|
||||||
def __init__(self, conf, memcache, logger=None):
|
def __init__(self, conf, memcache, logger=None, account_ring=None,
|
||||||
|
container_ring=None, object_ring=None):
|
||||||
if logger:
|
if logger:
|
||||||
self.logger = logger
|
self.logger = logger
|
||||||
else:
|
else:
|
||||||
@ -961,10 +962,12 @@ class BaseApplication(object):
|
|||||||
int(conf.get('recheck_account_existence', 60))
|
int(conf.get('recheck_account_existence', 60))
|
||||||
self.resellers_conf = ConfigParser()
|
self.resellers_conf = ConfigParser()
|
||||||
self.resellers_conf.read(os.path.join(swift_dir, 'resellers.conf'))
|
self.resellers_conf.read(os.path.join(swift_dir, 'resellers.conf'))
|
||||||
self.object_ring = Ring(os.path.join(swift_dir, 'object.ring.gz'))
|
self.object_ring = object_ring or \
|
||||||
self.container_ring = \
|
Ring(os.path.join(swift_dir, 'object.ring.gz'))
|
||||||
|
self.container_ring = container_ring or \
|
||||||
Ring(os.path.join(swift_dir, 'container.ring.gz'))
|
Ring(os.path.join(swift_dir, 'container.ring.gz'))
|
||||||
self.account_ring = Ring(os.path.join(swift_dir, 'account.ring.gz'))
|
self.account_ring = account_ring or \
|
||||||
|
Ring(os.path.join(swift_dir, 'account.ring.gz'))
|
||||||
self.memcache = memcache
|
self.memcache = memcache
|
||||||
self.rate_limit = float(conf.get('rate_limit', 20000.0))
|
self.rate_limit = float(conf.get('rate_limit', 20000.0))
|
||||||
self.account_rate_limit = float(conf.get('account_rate_limit', 200.0))
|
self.account_rate_limit = float(conf.get('account_rate_limit', 200.0))
|
||||||
|
@ -191,10 +191,9 @@ def save_globals():
|
|||||||
class TestObjectController(unittest.TestCase):
|
class TestObjectController(unittest.TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.app = proxy_server.Application(None, FakeMemcache())
|
self.app = proxy_server.Application(None, FakeMemcache(),
|
||||||
self.app.object_ring = FakeRing()
|
account_ring=FakeRing(), container_ring=FakeRing(),
|
||||||
self.app.container_ring = FakeRing()
|
object_ring=FakeRing())
|
||||||
self.app.account_ring = FakeRing()
|
|
||||||
|
|
||||||
def assert_status_map(self, method, statuses, expected, raise_exc=False):
|
def assert_status_map(self, method, statuses, expected, raise_exc=False):
|
||||||
with save_globals():
|
with save_globals():
|
||||||
@ -1447,10 +1446,9 @@ class TestContainerController(unittest.TestCase):
|
|||||||
"Test swift.proxy_server.ContainerController"
|
"Test swift.proxy_server.ContainerController"
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.app = proxy_server.Application(None, FakeMemcache())
|
self.app = proxy_server.Application(None, FakeMemcache(),
|
||||||
self.app.object_ring = FakeRing()
|
account_ring=FakeRing(), container_ring=FakeRing(),
|
||||||
self.app.container_ring = FakeRing()
|
object_ring=FakeRing())
|
||||||
self.app.account_ring = FakeRing()
|
|
||||||
|
|
||||||
def assert_status_map(self, method, statuses, expected, raise_exc=False, missing_container=False):
|
def assert_status_map(self, method, statuses, expected, raise_exc=False, missing_container=False):
|
||||||
with save_globals():
|
with save_globals():
|
||||||
@ -1635,10 +1633,9 @@ class TestContainerController(unittest.TestCase):
|
|||||||
class TestAccountController(unittest.TestCase):
|
class TestAccountController(unittest.TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.app = proxy_server.Application(None, FakeMemcache())
|
self.app = proxy_server.Application(None, FakeMemcache(),
|
||||||
self.app.object_ring = FakeRing()
|
account_ring=FakeRing(), container_ring=FakeRing(),
|
||||||
self.app.container_ring = FakeRing()
|
object_ring=FakeRing)
|
||||||
self.app.account_ring = FakeRing()
|
|
||||||
|
|
||||||
def assert_status_map(self, method, statuses, expected):
|
def assert_status_map(self, method, statuses, expected):
|
||||||
with save_globals():
|
with save_globals():
|
||||||
|
Loading…
Reference in New Issue
Block a user