Merge "node_timeout as float in configs"
This commit is contained in:
commit
a094560f0c
@ -352,7 +352,7 @@ folks a start on their own code if they want to use repoze.what::
|
||||
self.ssl = \
|
||||
conf.get('ssl', 'false').lower() in ('true', 'on', '1', 'yes')
|
||||
self.auth_prefix = conf.get('prefix', '/')
|
||||
self.timeout = int(conf.get('node_timeout', 10))
|
||||
self.timeout = float(conf.get('node_timeout', 10))
|
||||
|
||||
def authenticate(self, env, identity):
|
||||
token = identity.get('token')
|
||||
|
@ -70,7 +70,7 @@ class AccountReaper(Daemon):
|
||||
self.account_ring = None
|
||||
self.container_ring = None
|
||||
self.object_ring = None
|
||||
self.node_timeout = int(conf.get('node_timeout', 10))
|
||||
self.node_timeout = float(conf.get('node_timeout', 10))
|
||||
self.conn_timeout = float(conf.get('conn_timeout', 0.5))
|
||||
self.myips = whataremyips(conf.get('bind_ip', '0.0.0.0'))
|
||||
self.bind_port = int(conf.get('bind_port', 0))
|
||||
|
@ -166,7 +166,7 @@ class Replicator(Daemon):
|
||||
self.max_diffs = int(conf.get('max_diffs') or 100)
|
||||
self.interval = int(conf.get('interval') or
|
||||
conf.get('run_pause') or 30)
|
||||
self.node_timeout = int(conf.get('node_timeout', 10))
|
||||
self.node_timeout = float(conf.get('node_timeout', 10))
|
||||
self.conn_timeout = float(conf.get('conn_timeout', 0.5))
|
||||
self.rsync_compress = config_true_value(
|
||||
conf.get('rsync_compress', 'no'))
|
||||
|
@ -86,7 +86,7 @@ class ContainerController(BaseStorageServer):
|
||||
self.log_requests = config_true_value(conf.get('log_requests', 'true'))
|
||||
self.root = conf.get('devices', '/srv/node')
|
||||
self.mount_check = config_true_value(conf.get('mount_check', 'true'))
|
||||
self.node_timeout = int(conf.get('node_timeout', 3))
|
||||
self.node_timeout = float(conf.get('node_timeout', 3))
|
||||
self.conn_timeout = float(conf.get('conn_timeout', 0.5))
|
||||
#: ContainerSyncCluster instance for validating sync-to values.
|
||||
self.realms_conf = ContainerSyncRealms(
|
||||
|
@ -49,7 +49,7 @@ class ContainerUpdater(Daemon):
|
||||
self.account_ring = None
|
||||
self.concurrency = int(conf.get('concurrency', 4))
|
||||
self.slowdown = float(conf.get('slowdown', 0.01))
|
||||
self.node_timeout = int(conf.get('node_timeout', 3))
|
||||
self.node_timeout = float(conf.get('node_timeout', 3))
|
||||
self.conn_timeout = float(conf.get('conn_timeout', 0.5))
|
||||
self.no_changes = 0
|
||||
self.successes = 0
|
||||
|
@ -48,7 +48,7 @@ class ObjectUpdater(Daemon):
|
||||
self.container_ring = None
|
||||
self.concurrency = int(conf.get('concurrency', 1))
|
||||
self.slowdown = float(conf.get('slowdown', 0.01))
|
||||
self.node_timeout = int(conf.get('node_timeout', 10))
|
||||
self.node_timeout = float(conf.get('node_timeout', 10))
|
||||
self.conn_timeout = float(conf.get('conn_timeout', 0.5))
|
||||
self.successes = 0
|
||||
self.failures = 0
|
||||
|
@ -87,8 +87,8 @@ class Application(object):
|
||||
|
||||
swift_dir = conf.get('swift_dir', '/etc/swift')
|
||||
self.swift_dir = swift_dir
|
||||
self.node_timeout = int(conf.get('node_timeout', 10))
|
||||
self.recoverable_node_timeout = int(
|
||||
self.node_timeout = float(conf.get('node_timeout', 10))
|
||||
self.recoverable_node_timeout = float(
|
||||
conf.get('recoverable_node_timeout', self.node_timeout))
|
||||
self.conn_timeout = float(conf.get('conn_timeout', 0.5))
|
||||
self.client_timeout = int(conf.get('client_timeout', 60))
|
||||
|
@ -226,6 +226,11 @@ class TestReaper(unittest.TestCase):
|
||||
def fake_account_ring(self):
|
||||
return FakeRing()
|
||||
|
||||
def test_creation(self):
|
||||
# later config should be extended to assert more config options
|
||||
r = reaper.AccountReaper({'node_timeout': '3.5'})
|
||||
self.assertEqual(r.node_timeout, 3.5)
|
||||
|
||||
def test_delay_reaping_conf_default(self):
|
||||
r = reaper.AccountReaper({})
|
||||
self.assertEqual(r.delay_reaping, 0)
|
||||
|
@ -280,6 +280,11 @@ class TestDBReplicator(unittest.TestCase):
|
||||
def stub_delete_db(self, broker):
|
||||
self.delete_db_calls.append('/path/to/file')
|
||||
|
||||
def test_creation(self):
|
||||
# later config should be extended to assert more config options
|
||||
replicator = TestReplicator({'node_timeout': '3.5'})
|
||||
self.assertEqual(replicator.node_timeout, 3.5)
|
||||
|
||||
def test_repl_connection(self):
|
||||
node = {'replication_ip': '127.0.0.1', 'replication_port': 80,
|
||||
'device': 'sdb1'}
|
||||
|
@ -92,6 +92,12 @@ class TestContainerController(unittest.TestCase):
|
||||
self.assertEqual(str(policy_index),
|
||||
resp.headers['X-Backend-Storage-Policy-Index'])
|
||||
|
||||
def test_creation(self):
|
||||
# later config should be extended to assert more config options
|
||||
replicator = container_server.ContainerController(
|
||||
{'node_timeout': '3.5'})
|
||||
self.assertEqual(replicator.node_timeout, 3.5)
|
||||
|
||||
def test_get_and_validate_policy_index(self):
|
||||
# no policy is OK
|
||||
req = Request.blank('/sda1/p/a/container_default', method='PUT',
|
||||
|
@ -64,14 +64,14 @@ class TestContainerUpdater(unittest.TestCase):
|
||||
'swift_dir': self.testdir,
|
||||
'interval': '1',
|
||||
'concurrency': '2',
|
||||
'node_timeout': '5',
|
||||
'node_timeout': '5.',
|
||||
})
|
||||
self.assertTrue(hasattr(cu, 'logger'))
|
||||
self.assertTrue(cu.logger is not None)
|
||||
self.assertEqual(cu.devices, self.devices_dir)
|
||||
self.assertEqual(cu.interval, 1)
|
||||
self.assertEqual(cu.concurrency, 2)
|
||||
self.assertEqual(cu.node_timeout, 5)
|
||||
self.assertEqual(cu.node_timeout, 5.)
|
||||
self.assertTrue(cu.get_account_ring() is not None)
|
||||
|
||||
@mock.patch.object(container_updater, 'ismount')
|
||||
|
@ -84,13 +84,13 @@ class TestObjectUpdater(unittest.TestCase):
|
||||
'swift_dir': self.testdir,
|
||||
'interval': '1',
|
||||
'concurrency': '2',
|
||||
'node_timeout': '5'})
|
||||
'node_timeout': '5.'})
|
||||
self.assertTrue(hasattr(cu, 'logger'))
|
||||
self.assertTrue(cu.logger is not None)
|
||||
self.assertEqual(cu.devices, self.devices_dir)
|
||||
self.assertEqual(cu.interval, 1)
|
||||
self.assertEqual(cu.concurrency, 2)
|
||||
self.assertEqual(cu.node_timeout, 5)
|
||||
self.assertEqual(cu.node_timeout, 5.)
|
||||
self.assertTrue(cu.get_container_ring() is not None)
|
||||
|
||||
@mock.patch('os.listdir')
|
||||
|
@ -684,6 +684,16 @@ class TestController(unittest.TestCase):
|
||||
@patch_policies([StoragePolicy(0, 'zero', True, object_ring=FakeRing())])
|
||||
class TestProxyServer(unittest.TestCase):
|
||||
|
||||
def test_creation(self):
|
||||
# later config should be extended to assert more config options
|
||||
app = proxy_server.Application({'node_timeout': '3.5',
|
||||
'recoverable_node_timeout': '1.5'},
|
||||
FakeMemcache(),
|
||||
container_ring=FakeRing(),
|
||||
account_ring=FakeRing())
|
||||
self.assertEqual(app.node_timeout, 3.5)
|
||||
self.assertEqual(app.recoverable_node_timeout, 1.5)
|
||||
|
||||
def test_get_object_ring(self):
|
||||
baseapp = proxy_server.Application({},
|
||||
FakeMemcache(),
|
||||
|
Loading…
Reference in New Issue
Block a user