def _is_running(self): from patroni.dcs.etcd import DnsCachingResolver # if etcd is running, but we didn't start it try: self._client = self._client_cls({'host': 'localhost', 'port': 2379, 'retry_timeout': 30, 'patronictl': 1}, DnsCachingResolver()) return True except Exception: return False
def setUp(self): with patch.object(Client, 'machines') as mock_machines: mock_machines.__get__ = Mock(return_value=[ 'http://localhost:2379', 'http://localhost:4001' ]) self.client = Client({ 'srv': 'test', 'retry_timeout': 3 }, DnsCachingResolver()) self.client.http.request = http_request self.client.http.request_encode_body = http_request
def test_run(self): r = DnsCachingResolver() self.assertIsNone(r.resolve_async('', 0)) r.join()
def test_run(self): r = DnsCachingResolver() r._invoke_excepthook = Mock() self.assertIsNone(r.resolve_async('', 0)) r.join()
def test_authenticate(self): etcd3 = Etcd3Client({'host': '127.0.0.1', 'port': 2379, 'use_proxies': True, 'retry_timeout': 10}, DnsCachingResolver()) self.assertIsNotNone(etcd3._cluster_version)
def test_run(self): r = DnsCachingResolver() self.assertIsNone(r.resolve_async('', 0)) r.join()