Beispiel #1
0
    def client(self, open):
        param = {'host': 'localhost', 'port': '5000'}
        open.return_value = None

        cnn = Milvus()
        cnn.connect(**param)
        return cnn
Beispiel #2
0
    def test_disconnected(self, close, open):
        close.return_value = None
        open.return_value = None

        cnn = Milvus()
        cnn.connect(**self.param)

        assert cnn.disconnect().OK()
Beispiel #3
0
    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()
Beispiel #4
0
    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()
Beispiel #5
0
    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()
Beispiel #6
0
    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()
Beispiel #7
0
    def test_uri(self, open):
        open.return_value = None
        cnn = Milvus()

        cnn.connect(uri='tcp://127.0.0.1:9090')
        assert cnn.status.OK()
Beispiel #8
0
 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()
Beispiel #9
0
 def test_disconnected_error(self):
     cnn = Milvus()
     cnn.status = Status(Status.PERMISSION_DENIED)
     with pytest.raises(DisconnectNotConnectedClientError):
         cnn.disconnect()
Beispiel #10
0
 def test_false_connect(self):
     cnn = Milvus()
     with pytest.raises(NotConnectError):
         cnn.connect(**self.param)
         LOGGER.error(cnn.status)
         assert not cnn.status.OK()
Beispiel #11
0
 def test_connected(self):
     cnn = Milvus()
     with pytest.raises(NotConnectError):
         cnn.connect(host='123.0.0.2')
     assert not cnn.connected
Beispiel #12
0
 def test_connect_timeout(self):
     cnn = Milvus()
     with pytest.raises(NotConnectError):
         cnn.connect(host='123.0.0.2', port='19530')