Пример #1
0
 def test_parse_dcs(self):
     assert parse_dcs(None) is None
     assert parse_dcs('localhost') == {'etcd': {'host': 'localhost:2379'}}
     assert parse_dcs('') == {'etcd': {'host': 'localhost:2379'}}
     assert parse_dcs('localhost:8500') == {
         'consul': {
             'host': 'localhost:8500'
         }
     }
     assert parse_dcs('zookeeper://localhost') == {
         'zookeeper': {
             'hosts': ['localhost:2181']
         }
     }
     assert parse_dcs('exhibitor://dummy') == {
         'exhibitor': {
             'hosts': ['dummy'],
             'port': 8181
         }
     }
     assert parse_dcs('consul://localhost') == {
         'consul': {
             'host': 'localhost:8500'
         }
     }
     self.assertRaises(PatroniCtlException, parse_dcs, 'invalid://test')
 def test_parse_dcs(self):
     assert parse_dcs(None) is None
     assert parse_dcs('localhost') == {'etcd': {'host': 'localhost:4001'}}
     assert parse_dcs('') == {'etcd': {'host': 'localhost:4001'}}
     assert parse_dcs('localhost:8500') == {'consul': {'host': 'localhost:8500'}}
     assert parse_dcs('zookeeper://localhost') == {'zookeeper': {'hosts': ['localhost:2181']}}
     assert parse_dcs('exhibitor://dummy') == {'zookeeper': {'exhibitor': {'hosts': ['dummy'], 'port': 8181}}}
     assert parse_dcs('consul://localhost') == {'consul': {'host': 'localhost:8500'}}
     self.assertRaises(PatroniCtlException, parse_dcs, 'invalid://test')