Thrift plugin uses different format in cluster stats

This commit is contained in:
Honza Král
2013-10-29 17:45:49 +01:00
parent 6454372da6
commit 04afc03cdd
2 changed files with 10 additions and 2 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ from .serializer import JSONSerializer
from .exceptions import ConnectionError, TransportError, SerializationError
# get ip/port from "inet[wind/127.0.0.1:9200]"
ADDRESS_RE = re.compile(r'/(?P<host>[\.:0-9a-f]*):(?P<port>[0-9]+)\]')
ADDRESS_RE = re.compile(r'/(?P<host>[\.:0-9a-f]*):(?P<port>[0-9]+)\]?$')
def get_host_info(node_info, host):
+9 -1
View File
@@ -28,7 +28,8 @@ CLUSTER_NODES = '''{
"transport_address" : "inet[/127.0.0.1:9300]",
"hostname" : "wind",
"version" : "0.20.4",
"http_address" : "inet[/1.1.1.1:123]"
"http_address" : "inet[/1.1.1.1:123]",
"thrift_address" : "/1.1.1.1:9500]"
}
}
}'''
@@ -88,6 +89,13 @@ class TestTransport(TestCase):
self.assertEquals(1, len(t.connection_pool.connections))
self.assertEquals('http://1.1.1.1:123', t.get_connection().host)
def test_sniff_on_start_fetches_and_uses_nodes_list_for_its_schema(self):
class DummyThriftConnection(DummyConnection):
transport_schema = 'thrift'
t = Transport([{'data': CLUSTER_NODES}], connection_class=DummyThriftConnection, sniff_on_start=True)
self.assertEquals(1, len(t.connection_pool.connections))
self.assertEquals('thrift://1.1.1.1:9500', t.get_connection().host)
def test_sniff_on_start_fetches_and_uses_nodes_list(self):
t = Transport([{'data': CLUSTER_NODES}], connection_class=DummyConnection, sniff_on_start=True)
self.assertEquals(1, len(t.connection_pool.connections))