def client(self, open): param = {'host': 'localhost', 'port': '5000'} open.return_value = None cnn = Milvus() cnn.connect(**param) return cnn
def test_disconnected(self, close, open): close.return_value = None open.return_value = None cnn = Milvus() cnn.connect(**self.param) assert cnn.disconnect().OK()
def test_connect(self): cnn = Milvus() with pytest.raises(TTransport.TTransportException): cnn.connect('127.0.0.2') assert not cnn.status.OK() cnn.connect('127.0.0.1', '9999') assert not cnn.status.OK() cnn.connect(port='9999') assert not cnn.status.OK() cnn.connect(uri='tcp://127.0.0.1:9090') assert not cnn.status.OK()
def test_connect(self): cnn = Milvus() with pytest.raises(NotConnectError): cnn.connect('127.0.0.2') assert not cnn.status.OK() cnn.connect('127.0.0.1', '9999') assert not cnn.status.OK() cnn.connect(port='9999') assert not cnn.status.OK() cnn.connect(uri='tcp://127.0.0.1:9090') assert not cnn.status.OK()
def test_true_connect(self, open): open.return_value = None cnn = Milvus() cnn.connect(**self.param) assert cnn.status.OK assert cnn.connected with pytest.raises(RepeatingConnectError): cnn.connect(**self.param) cnn.connect()
def test_uri_runtime_error(self, open): open.return_value = None cnn = Milvus() with pytest.raises(RuntimeError): cnn.connect(uri='http://127.0.0.1:9090') cnn.connect() assert cnn.status.OK()
def test_uri(self, open): open.return_value = None cnn = Milvus() cnn.connect(uri='tcp://127.0.0.1:9090') assert cnn.status.OK()
def test_false_connect(self): cnn = Milvus() with pytest.raises(TTransport.TTransportException): cnn.connect(**self.param) LOGGER.error(cnn.status) assert not cnn.status.OK()
def test_disconnected_error(self): cnn = Milvus() cnn.status = Status(Status.PERMISSION_DENIED) with pytest.raises(DisconnectNotConnectedClientError): cnn.disconnect()
def test_false_connect(self): cnn = Milvus() with pytest.raises(NotConnectError): cnn.connect(**self.param) LOGGER.error(cnn.status) assert not cnn.status.OK()
def test_connected(self): cnn = Milvus() with pytest.raises(NotConnectError): cnn.connect(host='123.0.0.2') assert not cnn.connected
def test_connect_timeout(self): cnn = Milvus() with pytest.raises(NotConnectError): cnn.connect(host='123.0.0.2', port='19530')