def test_delete_table_timeout_exp(self, mock_callable, gip): mock_callable.side_effect = FError() self.client.connect(*gip) status = self.client.delete_table("a123") assert not status.OK()
def test_create_index_timeout_exp(self, mock_callable, gip): mock_callable.side_effect = FError() self.client.connect(*gip) status = self.client.create_index("a123", timeout=10) assert not status.OK()
def test__cmd_count_timeout_exp(self, mock_callable, gip): mock_callable.side_effect = FError() self.client.connect(*gip) status, _ = self.client._cmd(self.cmd_str) assert not status.OK()
def test_show_table_timeout_exp(self, mock_callable, gip): mock_callable.side_effect = FError() self.client.connect(*gip) status, _ = self.client.show_tables() assert not status.OK()
def test_get_table_row_count_timeout_exp(self, mock_callable, gip): mock_callable.side_effect = FError() self.client.connect(*gip) status, _ = self.client.get_table_row_count(self.table_name) assert not status.OK()
def test_preload_table_timeout_exp(self, mock_callable, gip): mock_callable.side_effect = FError() self.client.connect(*gip) status = self.client.preload_table(self.table_name) assert not status.OK()
def test_add_vectors_timeout_exp(self, mock_callable, gip): mock_callable.side_effect = FError() self.client.connect(*gip) status, _ = self.client.add_vectors(self.table_name, self.records) assert not status.OK()
def test_drop_index_timeout_exp(self, mock_callable, gip): mock_callable.side_effect = FError() self.client.connect(*gip) status = self.client.drop_index(self.table_name) assert not status.OK()
def test_drop_table_timeout_exp(self, gip): self.client.connected = mock.Mock(return_value=True) stub = FakeStub() future = FakeFuture() future.future = mock.Mock(side_effect=FError()) stub.DropTable = future self.client._stub = stub status = self.client.drop_table("a123") assert not status.OK()
def test_desribe_index_timeout_exp(self): self.client.connected = mock.Mock(return_value=True) stub = FakeStub() future = FakeFuture() future.future = mock.Mock(side_effect=FError()) stub.DescribeIndex = future self.client._stub = stub status, _ = self.client.describe_index(self.table_name) assert not status.OK()
def test_preload_table_timeout_exp(self): self.client.connected = mock.Mock(return_value=True) stub = FakeStub() future = FakeFuture() future.future = mock.Mock(side_effect=FError()) stub.PreloadTable = future self.client._stub = stub status = self.client.preload_table(self.table_name) assert not status.OK()
def test__cmd_count_timeout_exp(self): self.client.connected = mock.Mock(return_value=True) stub = FakeStub() future = FakeFuture() future.future = mock.Mock(side_effect=FError()) stub.Cmd = future self.client._stub = stub status, _ = self.client._cmd(self.cmd_str) assert not status.OK()
def test_show_table_timeout_exp(self): self.client.connected = mock.Mock(return_value=True) stub = FakeStub() future = FakeFuture() future.future = mock.Mock(side_effect=FError()) stub.ShowTables = future self.client._stub = stub status, _ = self.client.show_tables() assert not status.OK()
def test_drop_partition_timeout_exp(self): self.client.connected = mock.Mock(return_value=True) stub = FakeStub() future = FakeFuture() future.future = mock.Mock(side_effect=FError()) stub.DropPartition = future self.client._stub = stub status = self.client.drop_partition(self.table_name, 'tag') assert not status.OK()
def test_create_table_timeout_exp(self): self.client.connected = mock.Mock(return_value=True) stub = FakeStub() future = FakeFuture() future.future = mock.Mock(side_effect=FError()) stub.CreateTable = future self.client._stub = stub status = self.client.create_table(self.table_param) assert not status.OK()
def test_create_index_timeout_exp(self): self.client.connected = mock.Mock(return_value=True) stub = FakeStub() future = FakeFuture() future.future = mock.Mock(side_effect=FError()) stub.CreateIndex = future self.client._stub = stub status = self.client.create_index("a123", timeout=10) assert not status.OK()
def test_delete_by_range_timeout_exp(self): self.client.connected = mock.Mock(return_value=True) stub = FakeStub() future = FakeFuture() future.future = mock.Mock(side_effect=FError()) stub.DeleteByDate = future self.client._stub = stub status = self.client._GrpcMilvus__delete_vectors_by_range( self.table_name, start_date="2010-01-01", end_date="2099-12-31") assert not status.OK()
def test_insert_timeout_exp(self): self.client.connected = mock.Mock(return_value=True) stub = FakeStub() future = FakeFuture() future.future = mock.Mock(side_effect=FError()) stub.Insert = future self.client._stub = stub status, _ = self.client.insert(self.table_name, self.records, timeout=1) assert not status.OK()
class TestWithException: @mock.patch("grpc.channel_ready_future", side_effect=FError()) def test_with_timeout_error(self, _): with pytest.raises(NotConnectError): with GrpcMilvus(): pass @mock.patch("grpc.channel_ready_future", side_effect=RpcTestError()) def test_with_rpc_error(self, _): with pytest.raises(NotConnectError): with GrpcMilvus(): pass @mock.patch("grpc.channel_ready_future", side_effect=ValueError()) def test_with_unkonwn_error(self, _): with pytest.raises(NotConnectError): with GrpcMilvus(): pass