Skip to content

Commit

Permalink
Add mock for new API
Browse files Browse the repository at this point in the history
Signed-off-by: Congqi Xia <[email protected]>
  • Loading branch information
congqixia committed Dec 29, 2023
1 parent 4ab5bbb commit 743d1b2
Show file tree
Hide file tree
Showing 2 changed files with 291 additions and 160 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
}
Loading

0 comments on commit 743d1b2

Please sign in to comment.