Call self._load_machines_cache() method on timeout is causing switch to

a new server every 5 minutes
This commit is contained in:
Alexander Kukushkin
2017-01-12 17:30:18 +01:00
parent bbc67b2460
commit 711d53980f
2 changed files with 9 additions and 1 deletions
+3
View File
@@ -192,6 +192,9 @@ class TestClient(unittest.TestCase):
self.client._base_uri = 'http://localhost:4001'
self.client._machines_cache = ['http://localhost:2379']
self.client.api_execute('/', 'POST', timeout=0)
mock_machines.__get__ = Mock(return_value=['http://localhost:2379'])
self.client._machines_cache_updated = 0
self.client.api_execute('/', 'POST', timeout=0)
self.assertRaises(etcd.EtcdWatchTimedOut, self.client.api_execute, '/timeout', 'POST', params={'wait': 'true'})
self.assertRaises(etcd.EtcdException, self.client.api_execute, '/', '')
self.client._update_machines_cache = True