Skip to content

Commit

Permalink
Add mock methods for new APIs
Browse files Browse the repository at this point in the history
Signed-off-by: Congqi Xia <[email protected]>
  • Loading branch information
congqixia committed Jan 3, 2024
1 parent b0c8b5e commit ef8162c
Show file tree
Hide file tree
Showing 3 changed files with 292 additions and 161 deletions.
21 changes: 21 additions & 0 deletions client/client_mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ const (
MDescribeIndex ServiceMethod = 403
MGetIndexState ServiceMethod = 404
MGetIndexBuildProgress ServiceMethod = 405
MAlterIndex ServiceMethod = 406

MCreateCredential ServiceMethod = 500
MUpdateCredential ServiceMethod = 501
Expand All @@ -285,6 +286,7 @@ const (
MDelete ServiceMethod = 605
MQuery ServiceMethod = 606
MUpsert ServiceMethod = 607
MSearchV2 ServiceMethod = 608

MManualCompaction ServiceMethod = 700
MGetCompactionState ServiceMethod = 701
Expand Down Expand Up @@ -1005,3 +1007,22 @@ func (m *MockServer) Upsert(ctx context.Context, req *milvuspb.UpsertRequest) (*
s, err := SuccessStatus()
return &milvuspb.MutationResult{Status: s}, err
}

func (m *MockServer) AlterIndex(ctx context.Context, req *milvuspb.AlterIndexRequest) (*commonpb.Status, error) {
f := m.GetInjection(MUpsert)
if f != nil {
r, err := f(ctx, req)
return r.(*commonpb.Status), err
}
return SuccessStatus()
}

func (m *MockServer) SearchV2(ctx context.Context, req *milvuspb.SearchRequestV2) (*milvuspb.SearchResults, error) {
f := m.GetInjection(MUpsert)
if f != nil {
r, err := f(ctx, req)
return r.(*milvuspb.SearchResults), err
}
status, err := SuccessStatus()
return &milvuspb.SearchResults{Status: status}, err
}
2 changes: 1 addition & 1 deletion common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ package common

const (
// SDKVersion const value for current version
SDKVersion = `v2.3.3`
SDKVersion = `v2.4.0-dev`
)
Loading

0 comments on commit ef8162c

Please sign in to comment.