Пример #1
0
    def test_unix(self):
        endpoint = config.EndpointConfiguration(
            socket.AF_UNIX, "/tmp/socket")
        protocol = thrift_pool._make_protocol(endpoint)

        socket_transport = protocol.trans.getTransport()
        self.assertTrue(socket_transport._unix_socket)
Пример #2
0
    def test_inet(self):
        endpoint = config.EndpointConfiguration(
            socket.AF_INET, ("localhost", 1234))
        protocol = thrift_pool._make_protocol(endpoint)

        socket_transport = protocol.trans.getTransport()
        self.assertFalse(socket_transport._unix_socket)
Пример #3
0
    def test_inet(self):
        endpoint = config.EndpointConfiguration(socket.AF_INET,
                                                ("localhost", 1234))
        protocol = thrift_pool._make_protocol(endpoint)

        socket_transport = protocol.trans.getTransport()
        self.assertFalse(socket_transport._unix_socket)
Пример #4
0
    def test_unknown(self):
        endpoint = config.EndpointConfiguration(
            socket.AF_UNSPEC, None)

        with self.assertRaises(Exception):
            thrift_pool._make_protocol(endpoint)
Пример #5
0
    def test_unknown(self):
        endpoint = config.EndpointConfiguration(socket.AF_UNSPEC, None)

        with self.assertRaises(Exception):
            thrift_pool._make_protocol(endpoint)
Пример #6
0
    def test_unix(self):
        endpoint = config.EndpointConfiguration(socket.AF_UNIX, "/tmp/socket")
        protocol = thrift_pool._make_protocol(endpoint)

        socket_transport = protocol.trans.getTransport()
        self.assertTrue(socket_transport._unix_socket)
Пример #7
0
def check_thrift_service(endpoint):
    protocol = _make_protocol(endpoint)
    protocol.trans.getTransport().setTimeout(TIMEOUT * 1000.)
    protocol.trans.open()
    client = BaseplateService.Client(protocol)
    assert client.is_healthy(), "service indicated unhealthiness"