mirror of https://github.com/milvus-io/milvus.git
Return error response instead of panicking for unimplemented APIs (#26589)
Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>pull/26604/head
parent
8d3398c1fa
commit
c2b53bb9fe
|
@ -1099,11 +1099,21 @@ func (s *Server) ListResourceGroups(ctx context.Context, req *milvuspb.ListResou
|
|||
}
|
||||
|
||||
func (s *Server) ListIndexedSegment(ctx context.Context, req *federpb.ListIndexedSegmentRequest) (*federpb.ListIndexedSegmentResponse, error) {
|
||||
panic("TODO: implement me")
|
||||
return &federpb.ListIndexedSegmentResponse{
|
||||
Status: &commonpb.Status{
|
||||
ErrorCode: commonpb.ErrorCode_UnexpectedError,
|
||||
Reason: "not implemented",
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *Server) DescribeSegmentIndexData(ctx context.Context, req *federpb.DescribeSegmentIndexDataRequest) (*federpb.DescribeSegmentIndexDataResponse, error) {
|
||||
panic("TODO: implement me")
|
||||
return &federpb.DescribeSegmentIndexDataResponse{
|
||||
Status: &commonpb.Status{
|
||||
ErrorCode: commonpb.ErrorCode_UnexpectedError,
|
||||
Reason: "not implemented",
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *Server) Connect(ctx context.Context, req *milvuspb.ConnectRequest) (*milvuspb.ConnectResponse, error) {
|
||||
|
|
|
@ -42,6 +42,7 @@ import (
|
|||
"google.golang.org/grpc/health/grpc_health_v1"
|
||||
|
||||
"github.com/milvus-io/milvus-proto/go-api/v2/commonpb"
|
||||
"github.com/milvus-io/milvus-proto/go-api/v2/federpb"
|
||||
"github.com/milvus-io/milvus-proto/go-api/v2/milvuspb"
|
||||
"github.com/milvus-io/milvus/internal/mocks"
|
||||
"github.com/milvus-io/milvus/internal/proto/datapb"
|
||||
|
@ -1717,3 +1718,25 @@ func Test_NewServer_GetVersion(t *testing.T) {
|
|||
assert.NoError(t, err)
|
||||
})
|
||||
}
|
||||
|
||||
func TestNotImplementedAPIs(t *testing.T) {
|
||||
server := getServer(t)
|
||||
|
||||
t.Run("ListIndexedSegment", func(t *testing.T) {
|
||||
assert.NotPanics(t, func() {
|
||||
resp, err := server.ListIndexedSegment(context.TODO(), &federpb.ListIndexedSegmentRequest{})
|
||||
assert.NoError(t, err)
|
||||
assert.NotNil(t, resp)
|
||||
assert.Equal(t, commonpb.ErrorCode_UnexpectedError, resp.GetStatus().GetErrorCode())
|
||||
})
|
||||
})
|
||||
|
||||
t.Run("DescribeSegmentIndexData", func(t *testing.T) {
|
||||
assert.NotPanics(t, func() {
|
||||
resp, err := server.DescribeSegmentIndexData(context.TODO(), &federpb.DescribeSegmentIndexDataRequest{})
|
||||
assert.NoError(t, err)
|
||||
assert.NotNil(t, resp)
|
||||
assert.Equal(t, commonpb.ErrorCode_UnexpectedError, resp.GetStatus().GetErrorCode())
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue