Return error response when an unimplemented request is received (#24545)

Signed-off-by: SimFG <bang.fu@zilliz.com>
pull/24585/head
SimFG 2023-05-31 20:24:31 +08:00 committed by GitHub
parent bb62cf4e60
commit d246defa4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 46 additions and 13 deletions

View File

@ -723,11 +723,21 @@ func (s *Server) AlterAlias(ctx context.Context, request *milvuspb.AlterAliasReq
}
func (s *Server) DescribeAlias(ctx context.Context, request *milvuspb.DescribeAliasRequest) (*milvuspb.DescribeAliasResponse, error) {
panic("TODO: implement me")
return &milvuspb.DescribeAliasResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_UnexpectedError,
Reason: "TODO: implement me",
},
}, nil
}
func (s *Server) ListAliases(ctx context.Context, request *milvuspb.ListAliasesRequest) (*milvuspb.ListAliasesResponse, error) {
panic("TODO: implement me")
return &milvuspb.ListAliasesResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_UnexpectedError,
Reason: "TODO: implement me",
},
}, nil
}
// GetCompactionState gets the state of a compaction

View File

@ -20,8 +20,8 @@ import (
"strings"
"sync"
"github.com/cockroachdb/errors"
"github.com/google/btree"
"github.com/milvus-io/milvus/pkg/common"
)
@ -284,7 +284,7 @@ func (kv *MemoryKV) Close() {
// MultiRemoveWithPrefix not implemented
func (kv *MemoryKV) MultiRemoveWithPrefix(keys []string) error {
panic("not implement")
return errors.New("not implement")
}
// MultiSaveAndRemoveWithPrefix saves key-value pairs in @saves, & remove key with prefix in @removals in MemoryKV atomically.

View File

@ -2858,11 +2858,21 @@ func (node *Proxy) CreateAlias(ctx context.Context, request *milvuspb.CreateAlia
}
func (node *Proxy) DescribeAlias(ctx context.Context, request *milvuspb.DescribeAliasRequest) (*milvuspb.DescribeAliasResponse, error) {
panic("TODO: implement me")
return &milvuspb.DescribeAliasResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_UnexpectedError,
Reason: "TODO: implement me",
},
}, nil
}
func (node *Proxy) ListAliases(ctx context.Context, request *milvuspb.ListAliasesRequest) (*milvuspb.ListAliasesResponse, error) {
panic("TODO: implement me")
return &milvuspb.ListAliasesResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_UnexpectedError,
Reason: "TODO: implement me",
},
}, nil
}
// DropAlias alter the alias of collection.
@ -3159,7 +3169,12 @@ func (node *Proxy) FlushAll(ctx context.Context, _ *milvuspb.FlushAllRequest) (*
// GetDdChannel returns the used channel for dd operations.
func (node *Proxy) GetDdChannel(ctx context.Context, request *internalpb.GetDdChannelRequest) (*milvuspb.StringResponse, error) {
panic("implement me")
return &milvuspb.StringResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_UnexpectedError,
Reason: "TODO: implement me",
},
}, nil
}
// GetPersistentSegmentInfo get the information of sealed segment.
@ -5059,11 +5074,21 @@ func (node *Proxy) DescribeResourceGroup(ctx context.Context, request *milvuspb.
}
func (node *Proxy) ListIndexedSegment(ctx context.Context, request *federpb.ListIndexedSegmentRequest) (*federpb.ListIndexedSegmentResponse, error) {
panic("TODO: implement me")
return &federpb.ListIndexedSegmentResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_UnexpectedError,
Reason: "TODO: implement me",
},
}, nil
}
func (node *Proxy) DescribeSegmentIndexData(ctx context.Context, request *federpb.DescribeSegmentIndexDataRequest) (*federpb.DescribeSegmentIndexDataResponse, error) {
panic("TODO: implement me")
return &federpb.DescribeSegmentIndexDataResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_UnexpectedError,
Reason: "TODO: implement me",
},
}, nil
}
func (node *Proxy) Connect(ctx context.Context, request *milvuspb.ConnectRequest) (*milvuspb.ConnectResponse, error) {

View File

@ -1548,10 +1548,8 @@ func TestProxy(t *testing.T) {
})
t.Run("get dd channel", func(t *testing.T) {
f := func() {
_, _ = proxy.GetDdChannel(ctx, &internalpb.GetDdChannelRequest{})
}
assert.Panics(t, f)
resp, _ := proxy.GetDdChannel(ctx, &internalpb.GetDdChannelRequest{})
assert.NotEqual(t, commonpb.ErrorCode_Success, resp.Status.ErrorCode)
})
wg.Add(1)