Merge "Use float consistently for proxy timeout settings"

This commit is contained in:
Zuul 2020-03-04 07:29:42 +00:00 committed by Gerrit Code Review
commit efe084adab
2 changed files with 22 additions and 1 deletions

View File

@ -190,7 +190,7 @@ class Application(object):
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))
self.client_timeout = float(conf.get('client_timeout', 60))
self.object_chunk_size = int(conf.get('object_chunk_size', 65536))
self.client_chunk_size = int(conf.get('client_chunk_size', 65536))
self.trans_id_suffix = conf.get('trans_id_suffix', '')

View File

@ -1329,6 +1329,27 @@ class TestProxyServerLoading(unittest.TestCase):
for policy in POLICIES:
policy.object_ring = None
def test_float_timeouts(self):
conf = {
'node_timeout': '2.3',
'recoverable_node_timeout': '1.4',
'conn_timeout': '0.7',
'client_timeout': '1.7',
'post_quorum_timeout': '0.3',
'concurrency_timeout': '0.2',
}
for policy in POLICIES:
policy.object_ring = FakeRing()
app = proxy_server.Application(conf, FakeMemcache(), debug_logger(),
FakeRing(), FakeRing())
self.assertEqual(app.node_timeout, 2.3)
self.assertEqual(app.recoverable_node_timeout, 1.4)
self.assertEqual(app.conn_timeout, 0.7)
self.assertEqual(app.client_timeout, 1.7)
self.assertEqual(app.post_quorum_timeout, 0.3)
self.assertEqual(app.concurrency_timeout, 0.2)
def test_load_policy_rings(self):
for policy in POLICIES:
self.assertFalse(policy.object_ring)