diff --git a/client/client_grpc_alias_test.go b/client/client_grpc_alias_test.go index 29687f7c..f6f77b3a 100644 --- a/client/client_grpc_alias_test.go +++ b/client/client_grpc_alias_test.go @@ -33,7 +33,7 @@ func TestGrpcCreateAlias(t *testing.T) { t.Run("normal create alias", func(t *testing.T) { - mock.SetInjection(MCreateAlias, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MCreateAlias, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.CreateAliasRequest) if !ok { t.FailNow() @@ -43,14 +43,14 @@ func TestGrpcCreateAlias(t *testing.T) { return &common.Status{ErrorCode: common.ErrorCode_Success}, nil }) - defer mock.DelInjection(MCreateAlias) + defer mockServer.DelInjection(MCreateAlias) err := c.CreateAlias(ctx, "testcoll", "collAlias") assert.NoError(t, err) }) t.Run("alias duplicated", func(t *testing.T) { m := make(map[string]struct{}) - mock.SetInjection(MCreateAlias, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MCreateAlias, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.CreateAliasRequest) if !ok { t.FailNow() @@ -63,7 +63,7 @@ func TestGrpcCreateAlias(t *testing.T) { m[req.GetAlias()] = struct{}{} return &common.Status{ErrorCode: status}, nil }) - defer mock.DelInjection(MCreateAlias) + defer mockServer.DelInjection(MCreateAlias) collName := "testColl" aliasName := "collAlias" @@ -80,7 +80,7 @@ func TestGrpcDropAlias(t *testing.T) { defer c.Close() t.Run("normal drop alias", func(t *testing.T) { - mock.SetInjection(MDropAlias, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MDropAlias, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.DropAliasRequest) if !ok { t.FailNow() @@ -89,13 +89,13 @@ func TestGrpcDropAlias(t *testing.T) { return &common.Status{ErrorCode: common.ErrorCode_Success}, nil }) - defer mock.DelInjection(MDropAlias) + defer mockServer.DelInjection(MDropAlias) err := c.DropAlias(ctx, "collAlias") assert.NoError(t, err) }) t.Run("drop alias error", func(t *testing.T) { - mock.SetInjection(MDropAlias, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MDropAlias, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.DropAliasRequest) if !ok { t.FailNow() @@ -104,7 +104,7 @@ func TestGrpcDropAlias(t *testing.T) { return &common.Status{ErrorCode: common.ErrorCode_UnexpectedError}, nil }) - defer mock.DelInjection(MDropAlias) + defer mockServer.DelInjection(MDropAlias) err := c.DropAlias(ctx, "collAlias") assert.Error(t, err) }) @@ -119,7 +119,7 @@ func TestGrpcAlterAlias(t *testing.T) { aliasName := "collAlias" t.Run("normal alter alias", func(t *testing.T) { - mock.SetInjection(MAlterAlias, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MAlterAlias, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.AlterAliasRequest) if !ok { t.FailNow() @@ -129,13 +129,13 @@ func TestGrpcAlterAlias(t *testing.T) { return &common.Status{ErrorCode: common.ErrorCode_Success}, nil }) - defer mock.DelInjection(MAlterAlias) + defer mockServer.DelInjection(MAlterAlias) err := c.AlterAlias(ctx, collName, aliasName) assert.NoError(t, err) }) t.Run("alter alias error", func(t *testing.T) { - mock.SetInjection(MAlterAlias, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MAlterAlias, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.AlterAliasRequest) if !ok { t.FailNow() @@ -145,7 +145,7 @@ func TestGrpcAlterAlias(t *testing.T) { return &common.Status{ErrorCode: common.ErrorCode_UnexpectedError}, nil }) - defer mock.DelInjection(MAlterAlias) + defer mockServer.DelInjection(MAlterAlias) err := c.AlterAlias(ctx, collName, aliasName) assert.Error(t, err) }) diff --git a/client/client_grpc_authentication_test.go b/client/client_grpc_authentication_test.go index caf31768..1fbfd5e1 100644 --- a/client/client_grpc_authentication_test.go +++ b/client/client_grpc_authentication_test.go @@ -2,9 +2,10 @@ package client import ( "context" - "errors" "testing" + "github.com/cockroachdb/errors" + "github.com/golang/protobuf/proto" common "github.com/milvus-io/milvus-proto/go-api/commonpb" server "github.com/milvus-io/milvus-proto/go-api/milvuspb" @@ -16,42 +17,42 @@ func TestGrpcClient_CreateCredential(t *testing.T) { c := testClient(ctx, t) t.Run("create credential normal", func(t *testing.T) { - mock.SetInjection(MCreateCredential, func(ctx context.Context, _ proto.Message) (proto.Message, error) { + mockServer.SetInjection(MCreateCredential, func(ctx context.Context, _ proto.Message) (proto.Message, error) { s, err := SuccessStatus() return s, err }) - defer mock.DelInjection(MCreateCredential) + defer mockServer.DelInjection(MCreateCredential) err := c.CreateCredential(ctx, testUsername, testPassword) assert.Nil(t, err) }) t.Run("create credential invalid name", func(t *testing.T) { - mock.SetInjection(MCreateCredential, func(ctx context.Context, _ proto.Message) (proto.Message, error) { + mockServer.SetInjection(MCreateCredential, func(ctx context.Context, _ proto.Message) (proto.Message, error) { s, err := BadRequestStatus() return s, err }) - defer mock.DelInjection(MCreateCredential) + defer mockServer.DelInjection(MCreateCredential) err := c.CreateCredential(ctx, "123", testPassword) assert.Error(t, err) }) t.Run("create credential grpc error", func(t *testing.T) { - mock.SetInjection(MCreateCredential, func(ctx context.Context, raw proto.Message) (proto.Message, error) { - return &common.Status{}, errors.New("mocked grpc error") + mockServer.SetInjection(MCreateCredential, func(ctx context.Context, raw proto.Message) (proto.Message, error) { + return &common.Status{}, errors.New("mockServer.d grpc error") }) - defer mock.DelInjection(MCreateCredential) + defer mockServer.DelInjection(MCreateCredential) err := c.CreateCredential(ctx, testUsername, testPassword) assert.Error(t, err) }) t.Run("create credential server error", func(t *testing.T) { - mock.SetInjection(MCreateCredential, func(ctx context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MCreateCredential, func(ctx context.Context, raw proto.Message) (proto.Message, error) { return &common.Status{ ErrorCode: common.ErrorCode_UnexpectedError, Reason: "Service is not healthy", }, nil }) - defer mock.DelInjection(MCreateCredential) + defer mockServer.DelInjection(MCreateCredential) err := c.CreateCredential(ctx, testUsername, testPassword) assert.Error(t, err) }) @@ -62,32 +63,32 @@ func TestGrpcClient_UpdateCredential(t *testing.T) { c := testClient(ctx, t) t.Run("update credential normal", func(t *testing.T) { - mock.SetInjection(MUpdateCredential, func(ctx context.Context, _ proto.Message) (proto.Message, error) { + mockServer.SetInjection(MUpdateCredential, func(ctx context.Context, _ proto.Message) (proto.Message, error) { s, err := SuccessStatus() return s, err }) - defer mock.DelInjection(MUpdateCredential) + defer mockServer.DelInjection(MUpdateCredential) err := c.UpdateCredential(ctx, testUsername, testPassword, testPassword) assert.Nil(t, err) }) t.Run("update credential grpc error", func(t *testing.T) { - mock.SetInjection(MUpdateCredential, func(ctx context.Context, raw proto.Message) (proto.Message, error) { - return &common.Status{}, errors.New("mocked grpc error") + mockServer.SetInjection(MUpdateCredential, func(ctx context.Context, raw proto.Message) (proto.Message, error) { + return &common.Status{}, errors.New("mockServer.d grpc error") }) - defer mock.DelInjection(MUpdateCredential) + defer mockServer.DelInjection(MUpdateCredential) err := c.UpdateCredential(ctx, testUsername, testPassword, testPassword) assert.Error(t, err) }) t.Run("update credential server error", func(t *testing.T) { - mock.SetInjection(MUpdateCredential, func(ctx context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MUpdateCredential, func(ctx context.Context, raw proto.Message) (proto.Message, error) { return &common.Status{ ErrorCode: common.ErrorCode_UnexpectedError, Reason: "Service is not healthy", }, nil }) - defer mock.DelInjection(MUpdateCredential) + defer mockServer.DelInjection(MUpdateCredential) err := c.UpdateCredential(ctx, testUsername, testPassword, testPassword) assert.Error(t, err) }) @@ -98,32 +99,32 @@ func TestGrpcClient_DeleteCredential(t *testing.T) { c := testClient(ctx, t) t.Run("delete credential normal", func(t *testing.T) { - mock.SetInjection(MDeleteCredential, func(ctx context.Context, _ proto.Message) (proto.Message, error) { + mockServer.SetInjection(MDeleteCredential, func(ctx context.Context, _ proto.Message) (proto.Message, error) { s, err := SuccessStatus() return s, err }) - defer mock.DelInjection(MDeleteCredential) + defer mockServer.DelInjection(MDeleteCredential) err := c.DeleteCredential(ctx, testUsername) assert.Nil(t, err) }) t.Run("delete credential grpc error", func(t *testing.T) { - mock.SetInjection(MDeleteCredential, func(ctx context.Context, raw proto.Message) (proto.Message, error) { - return &common.Status{}, errors.New("mocked grpc error") + mockServer.SetInjection(MDeleteCredential, func(ctx context.Context, raw proto.Message) (proto.Message, error) { + return &common.Status{}, errors.New("mockServer.d grpc error") }) - defer mock.DelInjection(MDeleteCredential) + defer mockServer.DelInjection(MDeleteCredential) err := c.DeleteCredential(ctx, testUsername) assert.Error(t, err) }) t.Run("delete credential server error", func(t *testing.T) { - mock.SetInjection(MDeleteCredential, func(ctx context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MDeleteCredential, func(ctx context.Context, raw proto.Message) (proto.Message, error) { return &common.Status{ ErrorCode: common.ErrorCode_UnexpectedError, Reason: "Service is not healthy", }, nil }) - defer mock.DelInjection(MDeleteCredential) + defer mockServer.DelInjection(MDeleteCredential) err := c.DeleteCredential(ctx, testUsername) assert.Error(t, err) }) @@ -134,7 +135,7 @@ func TestGrpcClient_ListCredUsers(t *testing.T) { c := testClient(ctx, t) t.Run("list credential users normal", func(t *testing.T) { - mock.SetInjection(MListCredUsers, func(ctx context.Context, _ proto.Message) (proto.Message, error) { + mockServer.SetInjection(MListCredUsers, func(ctx context.Context, _ proto.Message) (proto.Message, error) { resp := &server.ListCredUsersResponse{ Usernames: []string{testUsername}, } @@ -142,23 +143,23 @@ func TestGrpcClient_ListCredUsers(t *testing.T) { resp.Status = s return resp, err }) - defer mock.DelInjection(MListCredUsers) + defer mockServer.DelInjection(MListCredUsers) names, err := c.ListCredUsers(ctx) assert.Nil(t, err) assert.Equal(t, []string{testUsername}, names) }) t.Run("list credential users grpc error", func(t *testing.T) { - mock.SetInjection(MListCredUsers, func(ctx context.Context, raw proto.Message) (proto.Message, error) { - return &server.ListCredUsersResponse{}, errors.New("mocked grpc error") + mockServer.SetInjection(MListCredUsers, func(ctx context.Context, raw proto.Message) (proto.Message, error) { + return &server.ListCredUsersResponse{}, errors.New("mockServer.d grpc error") }) - defer mock.DelInjection(MListCredUsers) + defer mockServer.DelInjection(MListCredUsers) _, err := c.ListCredUsers(ctx) assert.Error(t, err) }) t.Run("list credential users server error", func(t *testing.T) { - mock.SetInjection(MListCredUsers, func(ctx context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MListCredUsers, func(ctx context.Context, raw proto.Message) (proto.Message, error) { return &server.ListCredUsersResponse{ Status: &common.Status{ ErrorCode: common.ErrorCode_UnexpectedError, @@ -166,7 +167,7 @@ func TestGrpcClient_ListCredUsers(t *testing.T) { }, }, nil }) - defer mock.DelInjection(MListCredUsers) + defer mockServer.DelInjection(MListCredUsers) _, err := c.ListCredUsers(ctx) assert.Error(t, err) }) diff --git a/client/client_grpc_collection.go b/client/client_grpc_collection.go index e886226b..30be56e7 100644 --- a/client/client_grpc_collection.go +++ b/client/client_grpc_collection.go @@ -13,10 +13,11 @@ package client import ( "context" - "errors" "fmt" "time" + "github.com/cockroachdb/errors" + "github.com/golang/protobuf/proto" "github.com/milvus-io/milvus-sdk-go/v2/entity" "google.golang.org/grpc" diff --git a/client/client_grpc_collection_test.go b/client/client_grpc_collection_test.go index b99c71d6..1a4392ad 100644 --- a/client/client_grpc_collection_test.go +++ b/client/client_grpc_collection_test.go @@ -2,12 +2,13 @@ package client import ( "context" - "errors" "fmt" "math/rand" "testing" "time" + "github.com/cockroachdb/errors" + "github.com/golang/protobuf/proto" common "github.com/milvus-io/milvus-proto/go-api/commonpb" server "github.com/milvus-io/milvus-proto/go-api/milvuspb" @@ -53,7 +54,7 @@ func TestGrpcClientListCollections(t *testing.T) { } for _, tc := range cases { - mock.SetInjection(MShowCollections, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MShowCollections, func(_ context.Context, raw proto.Message) (proto.Message, error) { s, err := SuccessStatus() resp := &server.ShowCollectionsResponse{ Status: s, @@ -91,11 +92,11 @@ func TestGrpcClientCreateCollection(t *testing.T) { ctx := context.Background() c := testClient(ctx, t) // default, all collection name returns false - mock.DelInjection(MHasCollection) + mockServer.DelInjection(MHasCollection) t.Run("Test normal creation", func(t *testing.T) { ds := defaultSchema() shardsNum := int32(1) - mock.SetInjection(MCreateCollection, func(ctx context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MCreateCollection, func(ctx context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.CreateCollectionRequest) if !ok { return &common.Status{ErrorCode: common.ErrorCode_IllegalArgument}, errors.New("illegal request type") @@ -117,13 +118,13 @@ func TestGrpcClientCreateCollection(t *testing.T) { return &common.Status{ErrorCode: common.ErrorCode_Success}, nil }) assert.Nil(t, c.CreateCollection(ctx, ds, shardsNum)) - mock.DelInjection(MCreateCollection) + mockServer.DelInjection(MCreateCollection) }) t.Run("Test create with consistency level", func(t *testing.T) { ds := defaultSchema() shardsNum := int32(1) - mock.SetInjection(MCreateCollection, func(ctx context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MCreateCollection, func(ctx context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.CreateCollectionRequest) if !ok { return &common.Status{ErrorCode: common.ErrorCode_IllegalArgument}, errors.New("illegal request type") @@ -134,7 +135,7 @@ func TestGrpcClientCreateCollection(t *testing.T) { return &common.Status{ErrorCode: common.ErrorCode_Success}, nil }) assert.Nil(t, c.CreateCollection(ctx, ds, shardsNum, WithConsistencyLevel(entity.ClEventually))) - mock.DelInjection(MCreateCollection) + mockServer.DelInjection(MCreateCollection) }) t.Run("Test invalid schemas", func(t *testing.T) { @@ -222,20 +223,20 @@ func TestGrpcClientCreateCollection(t *testing.T) { }, } shardsNum := int32(1) // <= 0 will used default shards num 2, skip check - mock.SetInjection(MCreateCollection, func(_ context.Context, _ proto.Message) (proto.Message, error) { + mockServer.SetInjection(MCreateCollection, func(_ context.Context, _ proto.Message) (proto.Message, error) { // should not be here! assert.FailNow(t, "should not be here") return nil, errors.New("should not be here") }) for _, s := range cases { assert.NotNil(t, c.CreateCollection(ctx, s, shardsNum)) - mock.DelInjection(MCreateCollection) + mockServer.DelInjection(MCreateCollection) } }) t.Run("test duplicated collection", func(t *testing.T) { m := make(map[string]struct{}) - mock.SetInjection(MCreateCollection, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MCreateCollection, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.CreateCollectionRequest) if !ok { return BadRequestStatus() @@ -244,8 +245,8 @@ func TestGrpcClientCreateCollection(t *testing.T) { return SuccessStatus() }) - defer mock.DelInjection(MCreateCollection) - mock.SetInjection(MHasCollection, func(_ context.Context, raw proto.Message) (proto.Message, error) { + defer mockServer.DelInjection(MCreateCollection) + mockServer.SetInjection(MHasCollection, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.HasCollectionRequest) resp := &server.BoolResponse{} if !ok { @@ -258,14 +259,14 @@ func TestGrpcClientCreateCollection(t *testing.T) { resp.Status = s return resp, err }) - defer mock.DelInjection(MHasCollection) + defer mockServer.DelInjection(MHasCollection) assert.Nil(t, c.CreateCollection(ctx, defaultSchema(), 1)) assert.NotNil(t, c.CreateCollection(ctx, defaultSchema(), 1)) }) t.Run("test server returns error", func(t *testing.T) { - mock.SetInjection(MCreateCollection, func(ctx context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MCreateCollection, func(ctx context.Context, raw proto.Message) (proto.Message, error) { _, ok := raw.(*server.CreateCollectionRequest) if !ok { return BadRequestStatus() @@ -277,12 +278,12 @@ func TestGrpcClientCreateCollection(t *testing.T) { }) assert.Error(t, c.CreateCollection(ctx, defaultSchema(), 1)) - mock.SetInjection(MCreateCollection, func(ctx context.Context, raw proto.Message) (proto.Message, error) { - return &common.Status{}, errors.New("mocked grpc error") + mockServer.SetInjection(MCreateCollection, func(ctx context.Context, raw proto.Message) (proto.Message, error) { + return &common.Status{}, errors.New("mockServer.d grpc error") }) assert.Error(t, c.CreateCollection(ctx, defaultSchema(), 1)) - mock.DelInjection(MCreateCollection) + mockServer.DelInjection(MCreateCollection) }) } @@ -305,13 +306,13 @@ func TestGrpcClientDropCollection(t *testing.T) { ctx := context.Background() c := testClient(ctx, t) - mock.SetInjection(MHasCollection, hasCollectionDefault) - mock.SetInjection(MDropCollection, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MHasCollection, hasCollectionDefault) + mockServer.SetInjection(MDropCollection, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := (raw).(*server.DropCollectionRequest) if !ok { return BadRequestStatus() } - if req.GetCollectionName() != testCollectionName { // in mock server, assume testCollection exists only + if req.GetCollectionName() != testCollectionName { // in mockServer.server, assume testCollection exists only return BadRequestStatus() } return SuccessStatus() @@ -329,9 +330,9 @@ func TestGrpcClientDropCollection(t *testing.T) { func TestGrpcClientLoadCollection(t *testing.T) { ctx := context.Background() c := testClient(ctx, t) - mock.SetInjection(MHasCollection, hasCollectionDefault) + mockServer.SetInjection(MHasCollection, hasCollectionDefault) // injection check collection name equals - mock.SetInjection(MLoadCollection, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MLoadCollection, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.LoadCollectionRequest) if !ok { return BadRequestStatus() @@ -348,7 +349,7 @@ func TestGrpcClientLoadCollection(t *testing.T) { passed := false // ### flag variable start := time.Now() - mock.SetInjection(MShowCollections, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MShowCollections, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.ShowCollectionsRequest) r := &server.ShowCollectionsResponse{} if !ok || req == nil { @@ -378,10 +379,10 @@ func TestGrpcClientLoadCollection(t *testing.T) { assert.NotNil(t, c.LoadCollection(quickCtx, testCollectionName, false)) // remove injection - mock.DelInjection(MShowCollections) + mockServer.DelInjection(MShowCollections) }) t.Run("Load default replica", func(t *testing.T) { - mock.SetInjection(MLoadCollection, func(ctx context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MLoadCollection, func(ctx context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.LoadCollectionRequest) if !ok { return BadRequestStatus() @@ -390,13 +391,13 @@ func TestGrpcClientLoadCollection(t *testing.T) { assert.Equal(t, testCollectionName, req.GetCollectionName()) return SuccessStatus() }) - defer mock.DelInjection(MLoadCollection) + defer mockServer.DelInjection(MLoadCollection) assert.Nil(t, c.LoadCollection(ctx, testCollectionName, true)) }) t.Run("Load multiple replica", func(t *testing.T) { - mock.DelInjection(MLoadCollection) + mockServer.DelInjection(MLoadCollection) - mock.SetInjection(MLoadCollection, func(ctx context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MLoadCollection, func(ctx context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.LoadCollectionRequest) if !ok { return BadRequestStatus() @@ -405,7 +406,7 @@ func TestGrpcClientLoadCollection(t *testing.T) { assert.Equal(t, testCollectionName, req.GetCollectionName()) return SuccessStatus() }) - defer mock.DelInjection(MLoadCollection) + defer mockServer.DelInjection(MLoadCollection) assert.Nil(t, c.LoadCollection(ctx, testCollectionName, true, WithReplicaNumber(testMultiReplicaNumber))) }) } @@ -415,7 +416,7 @@ func TestReleaseCollection(t *testing.T) { c := testClient(ctx, t) - mock.SetInjection(MReleaseCollection, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MReleaseCollection, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.ReleaseCollectionRequest) if !ok { return BadRequestStatus() @@ -432,7 +433,7 @@ func TestGrpcClientHasCollection(t *testing.T) { c := testClient(ctx, t) - mock.SetInjection(MHasCollection, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MHasCollection, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.HasCollectionRequest) resp := &server.BoolResponse{} if !ok { @@ -509,7 +510,7 @@ func TestGrpcClientDescribeCollection(t *testing.T) { collectionID := rand.Int63() - mock.SetInjection(MDescribeCollection, describeCollectionInjection(t, collectionID, testCollectionName, defaultSchema())) + mockServer.SetInjection(MDescribeCollection, describeCollectionInjection(t, collectionID, testCollectionName, defaultSchema())) collection, err := c.DescribeCollection(ctx, testCollectionName) assert.Nil(t, err) @@ -526,7 +527,7 @@ func TestGrpcClientGetCollectionStatistics(t *testing.T) { stat := make(map[string]string) stat["row_count"] = "0" - mock.SetInjection(MGetCollectionStatistics, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MGetCollectionStatistics, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.GetCollectionStatisticsRequest) resp := &server.GetCollectionStatisticsResponse{} if !ok { @@ -557,10 +558,10 @@ func TestGrpcClientGetReplicas(t *testing.T) { replicaID := rand.Int63() nodeIds := []int64{1, 2, 3, 4} - mock.SetInjection(MHasCollection, hasCollectionDefault) - defer mock.DelInjection(MHasCollection) + mockServer.SetInjection(MHasCollection, hasCollectionDefault) + defer mockServer.DelInjection(MHasCollection) - mock.SetInjection(MShowCollections, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MShowCollections, func(_ context.Context, raw proto.Message) (proto.Message, error) { s, err := SuccessStatus() resp := &server.ShowCollectionsResponse{ Status: s, @@ -570,9 +571,9 @@ func TestGrpcClientGetReplicas(t *testing.T) { } return resp, err }) - defer mock.DelInjection(MShowCollections) + defer mockServer.DelInjection(MShowCollections) - mock.SetInjection(MGetReplicas, func(ctx context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MGetReplicas, func(ctx context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.GetReplicasRequest) resp := &server.GetReplicasResponse{} if !ok { @@ -619,15 +620,15 @@ func TestGrpcClientGetReplicas(t *testing.T) { }) t.Run("get replicas grpc error", func(t *testing.T) { - mock.SetInjection(MGetReplicas, func(ctx context.Context, raw proto.Message) (proto.Message, error) { - return &server.GetReplicasResponse{}, errors.New("mocked grpc error") + mockServer.SetInjection(MGetReplicas, func(ctx context.Context, raw proto.Message) (proto.Message, error) { + return &server.GetReplicasResponse{}, errors.New("mockServer.d grpc error") }) _, err := c.GetReplicas(ctx, testCollectionName) assert.Error(t, err) }) t.Run("get replicas server error", func(t *testing.T) { - mock.SetInjection(MGetReplicas, func(ctx context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MGetReplicas, func(ctx context.Context, raw proto.Message) (proto.Message, error) { return &server.GetReplicasResponse{ Status: &common.Status{ ErrorCode: common.ErrorCode_UnexpectedError, @@ -640,16 +641,16 @@ func TestGrpcClientGetReplicas(t *testing.T) { assert.Error(t, err) }) - mock.DelInjection(MGetReplicas) + mockServer.DelInjection(MGetReplicas) } func TestGrpcClientGetLoadingProgress(t *testing.T) { ctx := context.Background() c := testClient(ctx, t) - mock.SetInjection(MHasCollection, hasCollectionDefault) + mockServer.SetInjection(MHasCollection, hasCollectionDefault) - mock.SetInjection(MGetLoadingProgress, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MGetLoadingProgress, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.GetLoadingProgressRequest) if !ok { return BadRequestStatus() @@ -676,9 +677,9 @@ func TestGrpcClientGetLoadState(t *testing.T) { ctx := context.Background() c := testClient(ctx, t) - mock.SetInjection(MHasCollection, hasCollectionDefault) + mockServer.SetInjection(MHasCollection, hasCollectionDefault) - mock.SetInjection(MGetLoadState, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MGetLoadState, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.GetLoadStateRequest) if !ok { return BadRequestStatus() diff --git a/client/client_grpc_control_test.go b/client/client_grpc_control_test.go index dd93552e..356caf86 100644 --- a/client/client_grpc_control_test.go +++ b/client/client_grpc_control_test.go @@ -18,10 +18,11 @@ package client import ( "context" - "errors" "testing" "time" + "github.com/cockroachdb/errors" + "github.com/golang/protobuf/proto" common "github.com/milvus-io/milvus-proto/go-api/commonpb" server "github.com/milvus-io/milvus-proto/go-api/milvuspb" @@ -35,15 +36,15 @@ func TestGrpcManualCompaction(t *testing.T) { c := testClient(ctx, t) defer c.Close() - mock.SetInjection(MHasCollection, hasCollectionDefault) - defer mock.DelInjection(MHasCollection) + mockServer.SetInjection(MHasCollection, hasCollectionDefault) + defer mockServer.DelInjection(MHasCollection) compactionID := int64(1001) t.Run("normal manual compaction", func(t *testing.T) { now := time.Now() - mock.SetInjection(MDescribeCollection, describeCollectionInjection(t, testCollectionID, testCollectionName, defaultSchema())) - defer mock.DelInjection(MDescribeCollection) - mock.SetInjection(MManualCompaction, func(ctx context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MDescribeCollection, describeCollectionInjection(t, testCollectionID, testCollectionName, defaultSchema())) + defer mockServer.DelInjection(MDescribeCollection) + mockServer.SetInjection(MManualCompaction, func(ctx context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.ManualCompactionRequest) if !ok { t.FailNow() @@ -60,7 +61,7 @@ func TestGrpcManualCompaction(t *testing.T) { resp.Status = s return resp, err }) - defer mock.DelInjection(MManualCompaction) + defer mockServer.DelInjection(MManualCompaction) id, err := c.ManualCompaction(ctx, testCollectionName, 0) assert.NoError(t, err) @@ -75,28 +76,28 @@ func TestGrpcManualCompaction(t *testing.T) { }) t.Run("describe collection fail", func(t *testing.T) { - mock.SetInjection(MDescribeCollection, func(_ context.Context, _ proto.Message) (proto.Message, error) { - return &server.DescribeCollectionResponse{}, errors.New("mocked error") + mockServer.SetInjection(MDescribeCollection, func(_ context.Context, _ proto.Message) (proto.Message, error) { + return &server.DescribeCollectionResponse{}, errors.New("mockServer.d error") }) - defer mock.DelInjection(MDescribeCollection) + defer mockServer.DelInjection(MDescribeCollection) _, err := c.ManualCompaction(ctx, testCollectionName, 0) assert.Error(t, err) }) t.Run("compaction Service error", func(t *testing.T) { - mock.SetInjection(MDescribeCollection, describeCollectionInjection(t, testCollectionID, testCollectionName, defaultSchema())) - defer mock.DelInjection(MDescribeCollection) - mock.SetInjection(MManualCompaction, func(ctx context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MDescribeCollection, describeCollectionInjection(t, testCollectionID, testCollectionName, defaultSchema())) + defer mockServer.DelInjection(MDescribeCollection) + mockServer.SetInjection(MManualCompaction, func(ctx context.Context, raw proto.Message) (proto.Message, error) { resp := &server.ManualCompactionResponse{ CompactionID: 1001, } - return resp, errors.New("mocked grpc error") + return resp, errors.New("mockServer.d grpc error") }) _, err := c.ManualCompaction(ctx, testCollectionName, 0) assert.Error(t, err) - mock.SetInjection(MManualCompaction, func(ctx context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MManualCompaction, func(ctx context.Context, raw proto.Message) (proto.Message, error) { resp := &server.ManualCompactionResponse{ CompactionID: 1001, } @@ -106,7 +107,7 @@ func TestGrpcManualCompaction(t *testing.T) { return resp, nil }) - defer mock.DelInjection(MManualCompaction) + defer mockServer.DelInjection(MManualCompaction) _, err = c.ManualCompaction(ctx, testCollectionName, 0) assert.Error(t, err) @@ -123,7 +124,7 @@ func TestGrpcGetCompactionState(t *testing.T) { t.Run("normal get compaction state", func(t *testing.T) { state := common.CompactionState_Executing - mock.SetInjection(MGetCompactionState, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MGetCompactionState, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.GetCompactionStateRequest) if !ok { t.FailNow() @@ -138,7 +139,7 @@ func TestGrpcGetCompactionState(t *testing.T) { resp.Status = s return resp, err }) - defer mock.DelInjection(MGetCompactionState) + defer mockServer.DelInjection(MGetCompactionState) result, err := c.GetCompactionState(ctx, compactionID) assert.NoError(t, err) @@ -151,14 +152,14 @@ func TestGrpcGetCompactionState(t *testing.T) { }) t.Run("get compaction Service fail", func(t *testing.T) { - mock.SetInjection(MGetCompactionState, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MGetCompactionState, func(_ context.Context, raw proto.Message) (proto.Message, error) { resp := &server.GetCompactionStateResponse{} resp.Status = &common.Status{ ErrorCode: common.ErrorCode_UnexpectedError, } return resp, nil }) - defer mock.DelInjection(MGetCompactionState) + defer mockServer.DelInjection(MGetCompactionState) _, err := c.GetCompactionState(ctx, compactionID) assert.Error(t, err) @@ -179,7 +180,7 @@ func TestGrpcGetCompactionStateWithPlans(t *testing.T) { {Source: []int64{4, 5}, Target: 6, PlanType: entity.CompactionPlanMergeSegments}, } - mock.SetInjection(MGetCompactionStateWithPlans, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MGetCompactionStateWithPlans, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.GetCompactionPlansRequest) if !ok { t.FailNow() @@ -202,7 +203,7 @@ func TestGrpcGetCompactionStateWithPlans(t *testing.T) { resp.Status = s return resp, err }) - defer mock.DelInjection(MGetCompactionStateWithPlans) + defer mockServer.DelInjection(MGetCompactionStateWithPlans) result, rPlans, err := c.GetCompactionStateWithPlans(ctx, compactionID) assert.NoError(t, err) @@ -217,14 +218,14 @@ func TestGrpcGetCompactionStateWithPlans(t *testing.T) { }) t.Run("get compaction Service fail", func(t *testing.T) { - mock.SetInjection(MGetCompactionStateWithPlans, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MGetCompactionStateWithPlans, func(_ context.Context, raw proto.Message) (proto.Message, error) { resp := &server.GetCompactionPlansResponse{} resp.Status = &common.Status{ ErrorCode: common.ErrorCode_UnexpectedError, } return resp, nil }) - defer mock.DelInjection(MGetCompactionStateWithPlans) + defer mockServer.DelInjection(MGetCompactionStateWithPlans) _, _, err := c.GetCompactionStateWithPlans(ctx, compactionID) assert.Error(t, err) diff --git a/client/client_grpc_data.go b/client/client_grpc_data.go index d5085a1b..3befd64f 100644 --- a/client/client_grpc_data.go +++ b/client/client_grpc_data.go @@ -14,13 +14,14 @@ package client import ( "context" "encoding/json" - "errors" "fmt" "log" "strconv" "strings" "time" + "github.com/cockroachdb/errors" + "github.com/golang/protobuf/proto" common "github.com/milvus-io/milvus-proto/go-api/commonpb" server "github.com/milvus-io/milvus-proto/go-api/milvuspb" diff --git a/client/client_grpc_data_test.go b/client/client_grpc_data_test.go index f110c260..baeac8e4 100644 --- a/client/client_grpc_data_test.go +++ b/client/client_grpc_data_test.go @@ -2,12 +2,13 @@ package client import ( "context" - "errors" "fmt" "math/rand" "testing" "time" + "github.com/cockroachdb/errors" + "github.com/golang/protobuf/proto" "github.com/milvus-io/milvus-proto/go-api/commonpb" common "github.com/milvus-io/milvus-proto/go-api/commonpb" @@ -24,19 +25,19 @@ func TestGrpcClientInsert(t *testing.T) { c := testClient(ctx, t) t.Run("test create failure due to meta", func(t *testing.T) { - mock.DelInjection(MHasCollection) // collection does not exist + mockServer.DelInjection(MHasCollection) // collection does not exist ids, err := c.Insert(ctx, testCollectionName, "") assert.Nil(t, ids) assert.NotNil(t, err) // partition not exists - mock.SetInjection(MHasCollection, hasCollectionDefault) + mockServer.SetInjection(MHasCollection, hasCollectionDefault) ids, err = c.Insert(ctx, testCollectionName, "_part_not_exists") assert.Nil(t, ids) assert.NotNil(t, err) // field not in collection - mock.SetInjection(MDescribeCollection, describeCollectionInjection(t, 0, testCollectionName, defaultSchema())) + mockServer.SetInjection(MDescribeCollection, describeCollectionInjection(t, 0, testCollectionName, defaultSchema())) vectors := generateFloatVector(10, testVectorDim) ids, err = c.Insert(ctx, testCollectionName, "", entity.NewColumnInt64("extra_field", []int64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}), entity.NewColumnFloatVector(testVectorField, testVectorDim, vectors)) @@ -44,7 +45,7 @@ func TestGrpcClientInsert(t *testing.T) { assert.NotNil(t, err) // field type not match - mock.SetInjection(MDescribeCollection, describeCollectionInjection(t, 0, testCollectionName, defaultSchema())) + mockServer.SetInjection(MDescribeCollection, describeCollectionInjection(t, 0, testCollectionName, defaultSchema())) ids, err = c.Insert(ctx, testCollectionName, "", entity.NewColumnInt32("int64", []int32{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}), entity.NewColumnFloatVector(testVectorField, testVectorDim, vectors)) assert.Nil(t, ids) @@ -74,11 +75,11 @@ func TestGrpcClientInsert(t *testing.T) { assert.NotNil(t, err) }) - mock.SetInjection(MHasCollection, hasCollectionDefault) - mock.SetInjection(MDescribeCollection, describeCollectionInjection(t, 0, testCollectionName, defaultSchema())) + mockServer.SetInjection(MHasCollection, hasCollectionDefault) + mockServer.SetInjection(MDescribeCollection, describeCollectionInjection(t, 0, testCollectionName, defaultSchema())) vector := generateFloatVector(4096, testVectorDim) - mock.SetInjection(MInsert, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MInsert, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.InsertRequest) resp := &server.MutationResult{} if !ok { @@ -103,7 +104,7 @@ func TestGrpcClientInsert(t *testing.T) { _, err := c.Insert(ctx, testCollectionName, "", // use default partition entity.NewColumnFloatVector(testVectorField, testVectorDim, vector)) assert.Nil(t, err) - mock.DelInjection(MInsert) + mockServer.DelInjection(MInsert) } func TestGrpcClientFlush(t *testing.T) { @@ -127,7 +128,7 @@ func TestGrpcClientFlush(t *testing.T) { flushTime := 510 + rand.Intn(1500) start := time.Now() flag := false - mock.SetInjection(MFlush, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MFlush, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.FlushRequest) resp := &server.FlushResponse{} if !ok { @@ -147,7 +148,7 @@ func TestGrpcClientFlush(t *testing.T) { return resp, err }) - mock.SetInjection(MGetFlushState, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MGetFlushState, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.GetFlushStateRequest) resp := &server.GetFlushStateResponse{} if !ok { @@ -183,14 +184,14 @@ func TestGrpcDeleteByPks(t *testing.T) { c := testClient(ctx, t) defer c.Close() - mock.SetInjection(MDescribeCollection, describeCollectionInjection(t, 1, testCollectionName, defaultSchema())) - defer mock.DelInjection(MDescribeCollection) + mockServer.SetInjection(MDescribeCollection, describeCollectionInjection(t, 1, testCollectionName, defaultSchema())) + defer mockServer.DelInjection(MDescribeCollection) t.Run("normal delete by pks", func(t *testing.T) { partName := "testPart" - mock.SetInjection(MHasPartition, hasPartitionInjection(t, testCollectionName, true, partName)) - defer mock.DelInjection(MHasPartition) - mock.SetInjection(MDelete, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MHasPartition, hasPartitionInjection(t, testCollectionName, true, partName)) + defer mockServer.DelInjection(MHasPartition) + mockServer.SetInjection(MDelete, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.DeleteRequest) if !ok { t.FailNow() @@ -203,7 +204,7 @@ func TestGrpcDeleteByPks(t *testing.T) { resp.Status = s return resp, err }) - defer mock.DelInjection(MDelete) + defer mockServer.DelInjection(MDelete) err := c.DeleteByPks(ctx, testCollectionName, partName, entity.NewColumnInt64(testPrimaryField, []int64{1, 2, 3})) assert.NoError(t, err) @@ -211,8 +212,8 @@ func TestGrpcDeleteByPks(t *testing.T) { t.Run("Bad request deletes", func(t *testing.T) { partName := "testPart" - mock.SetInjection(MHasPartition, hasPartitionInjection(t, testCollectionName, false, partName)) - defer mock.DelInjection(MHasPartition) + mockServer.SetInjection(MHasPartition, hasPartitionInjection(t, testCollectionName, false, partName)) + defer mockServer.DelInjection(MHasPartition) // non-exist collection err := c.DeleteByPks(ctx, "non-exists-collection", "", entity.NewColumnInt64("pk", []int64{})) @@ -236,15 +237,15 @@ func TestGrpcDeleteByPks(t *testing.T) { }) t.Run("delete services fail", func(t *testing.T) { - mock.SetInjection(MDelete, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MDelete, func(_ context.Context, raw proto.Message) (proto.Message, error) { resp := &server.MutationResult{} - return resp, errors.New("mocked error") + return resp, errors.New("mockServer.d error") }) err := c.DeleteByPks(ctx, testCollectionName, "", entity.NewColumnInt64(testPrimaryField, []int64{1})) assert.Error(t, err) - mock.SetInjection(MDelete, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MDelete, func(_ context.Context, raw proto.Message) (proto.Message, error) { resp := &server.MutationResult{} resp.Status = &common.Status{ ErrorCode: common.ErrorCode_UnexpectedError, @@ -276,12 +277,12 @@ func TestGrpcSearch(t *testing.T) { }) t.Run("ok search", func(t *testing.T) { - mock.SetInjection(MHasCollection, hasCollectionDefault) - mock.SetInjection(MDescribeCollection, describeCollectionInjection(t, 0, testCollectionName, defaultSchema())) + mockServer.SetInjection(MHasCollection, hasCollectionDefault) + mockServer.SetInjection(MDescribeCollection, describeCollectionInjection(t, 0, testCollectionName, defaultSchema())) expr := `int64 > 0` - mock.SetInjection(MSearch, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MSearch, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.SearchRequest) resp := &server.SearchResults{} if !ok { @@ -357,11 +358,11 @@ func TestGrpcQuery(t *testing.T) { partName := "testPart" t.Run("normal query", func(t *testing.T) { - mock.SetInjection(MHasCollection, hasCollectionDefault) - mock.SetInjection(MHasPartition, hasPartitionInjection(t, testCollectionName, false, partName)) - defer mock.DelInjection(MHasPartition) + mockServer.SetInjection(MHasCollection, hasCollectionDefault) + mockServer.SetInjection(MHasPartition, hasPartitionInjection(t, testCollectionName, false, partName)) + defer mockServer.DelInjection(MHasPartition) - mock.SetInjection(MQuery, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MQuery, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.QueryRequest) if !ok { t.FailNow() @@ -406,7 +407,7 @@ func TestGrpcQuery(t *testing.T) { return resp, err }) - defer mock.DelInjection(MQuery) + defer mockServer.DelInjection(MQuery) columns, err := c.Query(ctx, testCollectionName, []string{partName}, "int64 in {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}", []string{testPrimaryField, testVectorField}, WithOffset(1), WithLimit(10)) assert.NoError(t, err) @@ -433,13 +434,13 @@ func TestGrpcQuery(t *testing.T) { }) t.Run("normal query varchar pks", func(t *testing.T) { - mock.SetInjection(MHasCollection, hasCollectionDefault) - mock.SetInjection(MHasPartition, hasPartitionInjection(t, testCollectionName, false, partName)) - defer mock.DelInjection(MHasPartition) - mock.SetInjection(MDescribeCollection, describeCollectionInjection(t, testCollectionID, testCollectionName, varCharSchema())) - defer mock.SetInjection(MDescribeCollection, describeCollectionInjection(t, testCollectionID, testCollectionName, defaultSchema())) + mockServer.SetInjection(MHasCollection, hasCollectionDefault) + mockServer.SetInjection(MHasPartition, hasPartitionInjection(t, testCollectionName, false, partName)) + defer mockServer.DelInjection(MHasPartition) + mockServer.SetInjection(MDescribeCollection, describeCollectionInjection(t, testCollectionID, testCollectionName, varCharSchema())) + defer mockServer.SetInjection(MDescribeCollection, describeCollectionInjection(t, testCollectionID, testCollectionName, defaultSchema())) - mock.SetInjection(MQuery, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MQuery, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.QueryRequest) if !ok { t.FailNow() @@ -484,7 +485,7 @@ func TestGrpcQuery(t *testing.T) { return resp, err }) - defer mock.DelInjection(MQuery) + defer mockServer.DelInjection(MQuery) columns, err := c.Query(ctx, testCollectionName, []string{partName}, `varchar in {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}`, []string{"varchar", testVectorField}) assert.NoError(t, err) @@ -499,10 +500,10 @@ func TestGrpcQuery(t *testing.T) { }) t.Run("Bad request querys", func(t *testing.T) { - mock.SetInjection(MHasCollection, hasCollectionDefault) - mock.SetInjection(MHasPartition, hasPartitionInjection(t, testCollectionName, false, partName)) - defer mock.DelInjection(MHasPartition) - mock.SetInjection(MDescribeCollection, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MHasCollection, hasCollectionDefault) + mockServer.SetInjection(MHasPartition, hasPartitionInjection(t, testCollectionName, false, partName)) + defer mockServer.DelInjection(MHasPartition) + mockServer.SetInjection(MDescribeCollection, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.DescribeCollectionRequest) resp := &server.DescribeCollectionResponse{} if !ok { @@ -526,7 +527,7 @@ func TestGrpcQuery(t *testing.T) { return resp, err }) - defer mock.SetInjection(MDescribeCollection, describeCollectionInjection(t, testCollectionID, testCollectionName, defaultSchema())) + defer mockServer.SetInjection(MDescribeCollection, describeCollectionInjection(t, testCollectionID, testCollectionName, defaultSchema())) // non-exist collection _, err := c.Query(ctx, "non-exists-collection", []string{}, "pk in {}", []string{}) @@ -534,25 +535,25 @@ func TestGrpcQuery(t *testing.T) { }) t.Run("Query Service error", func(t *testing.T) { - mock.SetInjection(MHasCollection, hasCollectionDefault) - mock.SetInjection(MHasPartition, hasPartitionInjection(t, testCollectionName, false, partName)) - defer mock.DelInjection(MHasPartition) + mockServer.SetInjection(MHasCollection, hasCollectionDefault) + mockServer.SetInjection(MHasPartition, hasPartitionInjection(t, testCollectionName, false, partName)) + defer mockServer.DelInjection(MHasPartition) - mock.SetInjection(MQuery, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MQuery, func(_ context.Context, raw proto.Message) (proto.Message, error) { _, ok := raw.(*server.QueryRequest) if !ok { t.FailNow() } resp := &server.QueryResults{} - return resp, errors.New("mocked error") + return resp, errors.New("mockServer.d error") }) - defer mock.DelInjection(MQuery) + defer mockServer.DelInjection(MQuery) _, err := c.Query(ctx, testCollectionName, []string{}, "int64 in {1}", []string{"*"}) assert.Error(t, err) - mock.SetInjection(MQuery, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MQuery, func(_ context.Context, raw proto.Message) (proto.Message, error) { _, ok := raw.(*server.QueryRequest) if !ok { t.FailNow() @@ -561,7 +562,7 @@ func TestGrpcQuery(t *testing.T) { resp := &server.QueryResults{} resp.Status = &common.Status{ ErrorCode: common.ErrorCode_UnexpectedError, - Reason: "mocked error", + Reason: "mockServer.d error", } return resp, nil }) @@ -569,7 +570,7 @@ func TestGrpcQuery(t *testing.T) { _, err = c.Query(ctx, testCollectionName, []string{}, "int64 in {1}", []string{"*"}) assert.Error(t, err) - mock.SetInjection(MQuery, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MQuery, func(_ context.Context, raw proto.Message) (proto.Message, error) { _, ok := raw.(*server.QueryRequest) if !ok { t.FailNow() @@ -599,7 +600,7 @@ func TestGrpcQuery(t *testing.T) { _, err = c.Query(ctx, testCollectionName, []string{}, "int64 in {1}", []string{"*"}) assert.Error(t, err) - mock.SetInjection(MQuery, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MQuery, func(_ context.Context, raw proto.Message) (proto.Message, error) { _, ok := raw.(*server.QueryRequest) if !ok { t.FailNow() @@ -638,11 +639,11 @@ func TestGrpcQueryByPks(t *testing.T) { partName := "testPart" t.Run("normal query by pks", func(t *testing.T) { - mock.SetInjection(MHasCollection, hasCollectionDefault) - mock.SetInjection(MHasPartition, hasPartitionInjection(t, testCollectionName, false, partName)) - defer mock.DelInjection(MHasPartition) + mockServer.SetInjection(MHasCollection, hasCollectionDefault) + mockServer.SetInjection(MHasPartition, hasPartitionInjection(t, testCollectionName, false, partName)) + defer mockServer.DelInjection(MHasPartition) - mock.SetInjection(MQuery, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MQuery, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.QueryRequest) if !ok { t.FailNow() @@ -687,7 +688,7 @@ func TestGrpcQueryByPks(t *testing.T) { return resp, err }) - defer mock.DelInjection(MQuery) + defer mockServer.DelInjection(MQuery) columns, err := c.QueryByPks(ctx, testCollectionName, []string{partName}, entity.NewColumnInt64(testPrimaryField, []int64{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}), []string{"int64", testVectorField}) assert.NoError(t, err) @@ -714,13 +715,13 @@ func TestGrpcQueryByPks(t *testing.T) { }) t.Run("normal query by varchar pks", func(t *testing.T) { - mock.SetInjection(MHasCollection, hasCollectionDefault) - mock.SetInjection(MHasPartition, hasPartitionInjection(t, testCollectionName, false, partName)) - defer mock.DelInjection(MHasPartition) - mock.SetInjection(MDescribeCollection, describeCollectionInjection(t, testCollectionID, testCollectionName, varCharSchema())) - defer mock.SetInjection(MDescribeCollection, describeCollectionInjection(t, testCollectionID, testCollectionName, defaultSchema())) + mockServer.SetInjection(MHasCollection, hasCollectionDefault) + mockServer.SetInjection(MHasPartition, hasPartitionInjection(t, testCollectionName, false, partName)) + defer mockServer.DelInjection(MHasPartition) + mockServer.SetInjection(MDescribeCollection, describeCollectionInjection(t, testCollectionID, testCollectionName, varCharSchema())) + defer mockServer.SetInjection(MDescribeCollection, describeCollectionInjection(t, testCollectionID, testCollectionName, defaultSchema())) - mock.SetInjection(MQuery, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MQuery, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.QueryRequest) if !ok { t.FailNow() @@ -765,7 +766,7 @@ func TestGrpcQueryByPks(t *testing.T) { return resp, err }) - defer mock.DelInjection(MQuery) + defer mockServer.DelInjection(MQuery) columns, err := c.QueryByPks(ctx, testCollectionName, []string{partName}, entity.NewColumnVarChar("varchar", []string{"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}), []string{"varchar", testVectorField}) assert.NoError(t, err) @@ -780,9 +781,9 @@ func TestGrpcQueryByPks(t *testing.T) { }) t.Run("Bad request querys", func(t *testing.T) { - mock.SetInjection(MHasCollection, hasCollectionDefault) - mock.SetInjection(MHasPartition, hasPartitionInjection(t, testCollectionName, false, partName)) - defer mock.DelInjection(MHasPartition) + mockServer.SetInjection(MHasCollection, hasCollectionDefault) + mockServer.SetInjection(MHasPartition, hasPartitionInjection(t, testCollectionName, false, partName)) + defer mockServer.DelInjection(MHasPartition) // non-exist collection _, err := c.QueryByPks(ctx, "non-exists-collection", []string{}, entity.NewColumnInt64("pk", []int64{}), []string{}) @@ -802,25 +803,25 @@ func TestGrpcQueryByPks(t *testing.T) { }) t.Run("Query Service error", func(t *testing.T) { - mock.SetInjection(MHasCollection, hasCollectionDefault) - mock.SetInjection(MHasPartition, hasPartitionInjection(t, testCollectionName, false, partName)) - defer mock.DelInjection(MHasPartition) + mockServer.SetInjection(MHasCollection, hasCollectionDefault) + mockServer.SetInjection(MHasPartition, hasPartitionInjection(t, testCollectionName, false, partName)) + defer mockServer.DelInjection(MHasPartition) - mock.SetInjection(MQuery, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MQuery, func(_ context.Context, raw proto.Message) (proto.Message, error) { _, ok := raw.(*server.QueryRequest) if !ok { t.FailNow() } resp := &server.QueryResults{} - return resp, errors.New("mocked error") + return resp, errors.New("mockServer.d error") }) - defer mock.DelInjection(MQuery) + defer mockServer.DelInjection(MQuery) _, err := c.QueryByPks(ctx, testCollectionName, []string{}, entity.NewColumnInt64(testPrimaryField, []int64{1}), []string{"*"}) assert.Error(t, err) - mock.SetInjection(MQuery, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MQuery, func(_ context.Context, raw proto.Message) (proto.Message, error) { _, ok := raw.(*server.QueryRequest) if !ok { t.FailNow() @@ -829,7 +830,7 @@ func TestGrpcQueryByPks(t *testing.T) { resp := &server.QueryResults{} resp.Status = &common.Status{ ErrorCode: common.ErrorCode_UnexpectedError, - Reason: "mocked error", + Reason: "mockServer.d error", } return resp, nil }) @@ -837,7 +838,7 @@ func TestGrpcQueryByPks(t *testing.T) { _, err = c.QueryByPks(ctx, testCollectionName, []string{}, entity.NewColumnInt64(testPrimaryField, []int64{1}), []string{"*"}) assert.Error(t, err) - mock.SetInjection(MQuery, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MQuery, func(_ context.Context, raw proto.Message) (proto.Message, error) { _, ok := raw.(*server.QueryRequest) if !ok { t.FailNow() @@ -867,7 +868,7 @@ func TestGrpcQueryByPks(t *testing.T) { _, err = c.QueryByPks(ctx, testCollectionName, []string{}, entity.NewColumnInt64(testPrimaryField, []int64{1}), []string{"*"}) assert.Error(t, err) - mock.SetInjection(MQuery, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MQuery, func(_ context.Context, raw proto.Message) (proto.Message, error) { _, ok := raw.(*server.QueryRequest) if !ok { t.FailNow() @@ -910,7 +911,7 @@ func TestGrpcCalcDistanceWithIDs(t *testing.T) { }) c := testClient(ctx, t) - mock.SetInjection(MDescribeCollection, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MDescribeCollection, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.DescribeCollectionRequest) resp := &server.DescribeCollectionResponse{} if !ok { @@ -956,7 +957,7 @@ func TestGrpcCalcDistanceWithIDs(t *testing.T) { }) t.Run("valid calls", func(t *testing.T) { - mock.SetInjection(MCalcDistance, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MCalcDistance, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.CalcDistanceRequest) resp := &server.CalcDistanceResults{} if !ok { @@ -1021,7 +1022,7 @@ func TestGrpcCalcDistanceWithIDs(t *testing.T) { assert.NotNil(t, r) // test IntDistance, - mock.SetInjection(MCalcDistance, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MCalcDistance, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.CalcDistanceRequest) resp := &server.CalcDistanceResults{} if !ok { @@ -1075,7 +1076,7 @@ func TestGrpcCalcDistanceWithIDs(t *testing.T) { assert.NotNil(t, r) // test str id - mock.SetInjection(MDescribeCollection, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MDescribeCollection, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.DescribeCollectionRequest) resp := &server.DescribeCollectionResponse{} if !ok { @@ -1094,7 +1095,7 @@ func TestGrpcCalcDistanceWithIDs(t *testing.T) { resp.Status = s return resp, err }) - mock.SetInjection(MCalcDistance, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MCalcDistance, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.CalcDistanceRequest) resp := &server.CalcDistanceResults{} if !ok { diff --git a/client/client_grpc_index_test.go b/client/client_grpc_index_test.go index a01843e2..e339fac4 100644 --- a/client/client_grpc_index_test.go +++ b/client/client_grpc_index_test.go @@ -2,11 +2,12 @@ package client import ( "context" - "errors" "math/rand" "testing" "time" + "github.com/cockroachdb/errors" + "github.com/golang/protobuf/proto" common "github.com/milvus-io/milvus-proto/go-api/commonpb" server "github.com/milvus-io/milvus-proto/go-api/milvuspb" @@ -17,8 +18,8 @@ import ( func TestGrpcClientCreateIndex(t *testing.T) { ctx := context.Background() c := testClient(ctx, t) - mock.SetInjection(MHasCollection, hasCollectionDefault) - mock.SetInjection(MDescribeCollection, describeCollectionInjection(t, 0, testCollectionName, defaultSchema())) + mockServer.SetInjection(MHasCollection, hasCollectionDefault) + mockServer.SetInjection(MDescribeCollection, describeCollectionInjection(t, 0, testCollectionName, defaultSchema())) fieldName := `vector` idx, err := entity.NewIndexFlat(entity.IP) @@ -26,7 +27,7 @@ func TestGrpcClientCreateIndex(t *testing.T) { if !assert.NotNil(t, idx) { t.FailNow() } - mock.SetInjection(MCreateIndex, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MCreateIndex, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.CreateIndexRequest) if !ok { return BadRequestStatus() @@ -41,13 +42,13 @@ func TestGrpcClientCreateIndex(t *testing.T) { }) t.Run("test flush err", func(t *testing.T) { - mock.SetInjection(MFlush, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MFlush, func(_ context.Context, raw proto.Message) (proto.Message, error) { resp := &server.FlushResponse{} s, err := BadRequestStatus() resp.Status = s return resp, err }) - defer mock.DelInjection(MFlush) + defer mockServer.DelInjection(MFlush) assert.NotNil(t, c.CreateIndex(ctx, testCollectionName, fieldName, idx, false)) }) @@ -55,7 +56,7 @@ func TestGrpcClientCreateIndex(t *testing.T) { buildTime := rand.Intn(900) + 100 start := time.Now() flag := false - mock.SetInjection(MDescribeIndex, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MDescribeIndex, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.DescribeIndexRequest) resp := &server.DescribeIndexResponse{} if !ok { @@ -86,29 +87,29 @@ func TestGrpcClientCreateIndex(t *testing.T) { assert.Nil(t, c.CreateIndex(ctx, testCollectionName, fieldName, idx, false, WithIndexName("test-index"))) assert.True(t, flag) - mock.DelInjection(MDescribeIndex) + mockServer.DelInjection(MDescribeIndex) }) } func TestGrpcClientDropIndex(t *testing.T) { ctx := context.Background() c := testClient(ctx, t) - mock.SetInjection(MHasCollection, hasCollectionDefault) - mock.SetInjection(MDescribeCollection, describeCollectionInjection(t, 0, testCollectionName, defaultSchema())) + mockServer.SetInjection(MHasCollection, hasCollectionDefault) + mockServer.SetInjection(MDescribeCollection, describeCollectionInjection(t, 0, testCollectionName, defaultSchema())) assert.Nil(t, c.DropIndex(ctx, testCollectionName, "vector")) } func TestGrpcClientDescribeIndex(t *testing.T) { ctx := context.Background() - mock.SetInjection(MHasCollection, hasCollectionDefault) - mock.SetInjection(MDescribeCollection, describeCollectionInjection(t, 0, testCollectionName, defaultSchema())) + mockServer.SetInjection(MHasCollection, hasCollectionDefault) + mockServer.SetInjection(MDescribeCollection, describeCollectionInjection(t, 0, testCollectionName, defaultSchema())) c := testClient(ctx, t) fieldName := "vector" t.Run("normal describe index", func(t *testing.T) { - mock.SetInjection(MDescribeIndex, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MDescribeIndex, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.DescribeIndexRequest) resp := &server.DescribeIndexResponse{} if !ok { @@ -140,17 +141,17 @@ func TestGrpcClientDescribeIndex(t *testing.T) { }) t.Run("Service return errors", func(t *testing.T) { - defer mock.DelInjection(MDescribeIndex) - mock.SetInjection(MDescribeIndex, func(_ context.Context, raw proto.Message) (proto.Message, error) { + defer mockServer.DelInjection(MDescribeIndex) + mockServer.SetInjection(MDescribeIndex, func(_ context.Context, raw proto.Message) (proto.Message, error) { resp := &server.DescribeIndexResponse{} - return resp, errors.New("mocked error") + return resp, errors.New("mockServer.d error") }) _, err := c.DescribeIndex(ctx, testCollectionName, fieldName) assert.Error(t, err) - mock.SetInjection(MDescribeIndex, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MDescribeIndex, func(_ context.Context, raw proto.Message) (proto.Message, error) { resp := &server.DescribeIndexResponse{} resp.Status = &common.Status{ErrorCode: common.ErrorCode_UnexpectedError} return resp, nil @@ -163,8 +164,8 @@ func TestGrpcClientDescribeIndex(t *testing.T) { func TestGrpcGetIndexBuildProgress(t *testing.T) { ctx := context.Background() - mock.SetInjection(MHasCollection, hasCollectionDefault) - mock.SetInjection(MDescribeCollection, describeCollectionInjection(t, 0, testCollectionName, defaultSchema())) + mockServer.SetInjection(MHasCollection, hasCollectionDefault) + mockServer.SetInjection(MDescribeCollection, describeCollectionInjection(t, 0, testCollectionName, defaultSchema())) tc := testClient(ctx, t) c := tc.(*GrpcClient) // since GetIndexBuildProgress is not exposed @@ -172,7 +173,7 @@ func TestGrpcGetIndexBuildProgress(t *testing.T) { t.Run("normal get index build progress", func(t *testing.T) { var total, built int64 - mock.SetInjection(MGetIndexBuildProgress, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MGetIndexBuildProgress, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.GetIndexBuildProgressRequest) if !ok { t.FailNow() @@ -196,20 +197,20 @@ func TestGrpcGetIndexBuildProgress(t *testing.T) { }) t.Run("Service return errors", func(t *testing.T) { - defer mock.DelInjection(MGetIndexBuildProgress) - mock.SetInjection(MGetIndexBuildProgress, func(_ context.Context, raw proto.Message) (proto.Message, error) { + defer mockServer.DelInjection(MGetIndexBuildProgress) + mockServer.SetInjection(MGetIndexBuildProgress, func(_ context.Context, raw proto.Message) (proto.Message, error) { _, ok := raw.(*server.GetIndexBuildProgressRequest) if !ok { t.FailNow() } resp := &server.GetIndexBuildProgressResponse{} - return resp, errors.New("mocked error") + return resp, errors.New("mockServer.d error") }) _, _, err := c.GetIndexBuildProgress(ctx, testCollectionName, testVectorField) assert.Error(t, err) - mock.SetInjection(MGetIndexBuildProgress, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MGetIndexBuildProgress, func(_ context.Context, raw proto.Message) (proto.Message, error) { _, ok := raw.(*server.GetIndexBuildProgressRequest) if !ok { t.FailNow() diff --git a/client/client_grpc_options.go b/client/client_grpc_options.go index 3d756d58..f856d894 100644 --- a/client/client_grpc_options.go +++ b/client/client_grpc_options.go @@ -12,9 +12,10 @@ package client import ( - "errors" "fmt" + "github.com/cockroachdb/errors" + common "github.com/milvus-io/milvus-proto/go-api/commonpb" server "github.com/milvus-io/milvus-proto/go-api/milvuspb" "github.com/milvus-io/milvus-sdk-go/v2/entity" diff --git a/client/client_grpc_partition.go b/client/client_grpc_partition.go index 8a161758..87612331 100644 --- a/client/client_grpc_partition.go +++ b/client/client_grpc_partition.go @@ -13,10 +13,11 @@ package client import ( "context" - "errors" "fmt" "time" + "github.com/cockroachdb/errors" + common "github.com/milvus-io/milvus-proto/go-api/commonpb" server "github.com/milvus-io/milvus-proto/go-api/milvuspb" "github.com/milvus-io/milvus-sdk-go/v2/entity" diff --git a/client/client_grpc_partition_test.go b/client/client_grpc_partition_test.go index 1c96d2b0..a82a575b 100644 --- a/client/client_grpc_partition_test.go +++ b/client/client_grpc_partition_test.go @@ -2,12 +2,13 @@ package client import ( "context" - "errors" "fmt" "math/rand" "testing" "time" + "github.com/cockroachdb/errors" + "github.com/golang/protobuf/proto" common "github.com/milvus-io/milvus-proto/go-api/commonpb" server "github.com/milvus-io/milvus-proto/go-api/milvuspb" @@ -49,8 +50,8 @@ func TestGrpcClientCreatePartition(t *testing.T) { partitionName := fmt.Sprintf("_part_%d", rand.Int()) - mock.SetInjection(MHasCollection, hasCollectionDefault) - mock.SetInjection(MHasPartition, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MHasCollection, hasCollectionDefault) + mockServer.SetInjection(MHasPartition, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.HasPartitionRequest) resp := &server.BoolResponse{} if !ok { @@ -73,8 +74,8 @@ func TestGrpcClientDropPartition(t *testing.T) { partitionName := fmt.Sprintf("_part_%d", rand.Int()) ctx := context.Background() c := testClient(ctx, t) - mock.SetInjection(MHasCollection, hasCollectionDefault) - mock.SetInjection(MHasPartition, hasPartitionInjection(t, testCollectionName, true, partitionName)) // injection has assertion of collName & parition name + mockServer.SetInjection(MHasCollection, hasCollectionDefault) + mockServer.SetInjection(MHasPartition, hasPartitionInjection(t, testCollectionName, true, partitionName)) // injection has assertion of collName & parition name assert.Nil(t, c.DropPartition(ctx, testCollectionName, partitionName)) } @@ -82,8 +83,8 @@ func TestGrpcClientHasPartition(t *testing.T) { partitionName := fmt.Sprintf("_part_%d", rand.Int()) ctx := context.Background() c := testClient(ctx, t) - mock.SetInjection(MHasCollection, hasCollectionDefault) - mock.SetInjection(MHasPartition, hasPartitionInjection(t, testCollectionName, false, partitionName)) // injection has assertion of collName & parition name + mockServer.SetInjection(MHasCollection, hasCollectionDefault) + mockServer.SetInjection(MHasPartition, hasPartitionInjection(t, testCollectionName, false, partitionName)) // injection has assertion of collName & parition name r, err := c.HasPartition(ctx, testCollectionName, "_default_part") assert.Nil(t, err) @@ -149,7 +150,7 @@ func TestGrpcClientShowPartitions(t *testing.T) { }, } for _, tc := range cases { - mock.SetInjection(MShowPartitions, getPartitionsInterception(t, tc.collName, tc.partitions...)) + mockServer.SetInjection(MShowPartitions, getPartitionsInterception(t, tc.collName, tc.partitions...)) r, err := c.ShowPartitions(ctx, tc.collName) if tc.shouldSuccess { assert.Nil(t, err) @@ -170,8 +171,8 @@ func TestGrpcClientLoadPartitions(t *testing.T) { ctx := context.Background() c := testClient(ctx, t) - mock.SetInjection(MHasCollection, hasCollectionDefault) - mock.SetInjection(MHasPartition, hasPartitionInjection(t, testCollectionName, true, "_part1", "_part2", "_part3", "_part4")) + mockServer.SetInjection(MHasCollection, hasCollectionDefault) + mockServer.SetInjection(MHasPartition, hasPartitionInjection(t, testCollectionName, true, "_part1", "_part2", "_part3", "_part4")) type testCase struct { collName string @@ -224,7 +225,7 @@ func TestGrpcClientLoadPartitions(t *testing.T) { start := time.Now() loadTime := rand.Intn(1500) + 100 loaded := false - mock.SetInjection(MShowPartitions, func(ctx context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MShowPartitions, func(ctx context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.ShowPartitionsRequest) resp := &server.ShowPartitionsResponse{} if !ok { @@ -280,7 +281,7 @@ func TestGrpcClientLoadPartitions(t *testing.T) { } // paritions will not be loaded - mock.SetInjection(MShowPartitions, func(ctx context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MShowPartitions, func(ctx context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.ShowPartitionsRequest) resp := &server.ShowPartitionsResponse{} if !ok { @@ -305,21 +306,21 @@ func TestGrpcClientLoadPartitions(t *testing.T) { defer cancel() assert.NotNil(t, c.LoadPartitions(quickCtx, tc.collName, tc.loadNames, false)) - mock.SetInjection(MShowPartitions, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MShowPartitions, func(_ context.Context, raw proto.Message) (proto.Message, error) { return &server.ShowPartitionsResponse{}, errors.New("always fail") }) - defer mock.DelInjection(MShowPartitions) + defer mockServer.DelInjection(MShowPartitions) err := c.LoadPartitions(ctx, tc.collName, tc.loadNames, false) assert.NotNil(t, err) - mock.SetInjection(MLoadPartitions, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MLoadPartitions, func(_ context.Context, raw proto.Message) (proto.Message, error) { return &common.Status{}, errors.New("has partition failed") }) err = c.LoadPartitions(ctx, tc.collName, tc.loadNames, false) assert.NotNil(t, err) - mock.SetInjection(MHasPartition, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MHasPartition, func(_ context.Context, raw proto.Message) (proto.Message, error) { return &server.BoolResponse{}, errors.New("has partition failed") }) err = c.LoadPartitions(ctx, tc.collName, tc.loadNames, false) @@ -334,9 +335,9 @@ func TestGrpcClientReleasePartitions(t *testing.T) { c := testClient(ctx, t) parts := []string{"_part1", "_part2"} - mock.SetInjection(MHasCollection, hasCollectionDefault) - mock.SetInjection(MHasPartition, hasPartitionInjection(t, testCollectionName, true, "_part1", "_part2", "_part3", "_part4")) - mock.SetInjection(MReleasePartitions, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MHasCollection, hasCollectionDefault) + mockServer.SetInjection(MHasPartition, hasPartitionInjection(t, testCollectionName, true, "_part1", "_part2", "_part3", "_part4")) + mockServer.SetInjection(MReleasePartitions, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.ReleasePartitionsRequest) if !ok { return BadRequestStatus() @@ -370,14 +371,14 @@ func TestGrpcShowPartitions(t *testing.T) { } t.Run("normal show partitions", func(t *testing.T) { - mock.SetInjection(MShowPartitions, getPartitionsInterception(t, testCollectionName, partitions...)) + mockServer.SetInjection(MShowPartitions, getPartitionsInterception(t, testCollectionName, partitions...)) parts, err := c.ShowPartitions(ctx, testCollectionName) assert.NoError(t, err) assert.NotNil(t, parts) }) t.Run("bad response", func(t *testing.T) { - mock.SetInjection(MShowPartitions, func(ctx context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MShowPartitions, func(ctx context.Context, raw proto.Message) (proto.Message, error) { resp := &server.ShowPartitionsResponse{} resp.PartitionIDs = make([]int64, 0, len(partitions)) for _, part := range partitions { @@ -392,15 +393,15 @@ func TestGrpcShowPartitions(t *testing.T) { }) t.Run("Service error", func(t *testing.T) { - mock.SetInjection(MShowPartitions, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MShowPartitions, func(_ context.Context, raw proto.Message) (proto.Message, error) { return &server.ShowPartitionsResponse{}, errors.New("always fail") }) - defer mock.DelInjection(MShowPartitions) + defer mockServer.DelInjection(MShowPartitions) _, err := c.ShowPartitions(ctx, testCollectionName) assert.Error(t, err) - mock.SetInjection(MShowPartitions, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MShowPartitions, func(_ context.Context, raw proto.Message) (proto.Message, error) { return &server.ShowPartitionsResponse{ Status: &common.Status{ErrorCode: common.ErrorCode_UnexpectedError}, }, nil diff --git a/client/client_grpc_rbac_test.go b/client/client_grpc_rbac_test.go index 8ca9f1a3..3b72a192 100644 --- a/client/client_grpc_rbac_test.go +++ b/client/client_grpc_rbac_test.go @@ -2,71 +2,21 @@ package client import ( "context" - "errors" - "net" "testing" + "github.com/cockroachdb/errors" + "github.com/milvus-io/milvus-sdk-go/v2/entity" - "github.com/milvus-io/milvus-sdk-go/v2/mocks" "github.com/stretchr/testify/suite" - "google.golang.org/grpc" - "google.golang.org/grpc/test/bufconn" - tmock "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/mock" common "github.com/milvus-io/milvus-proto/go-api/commonpb" server "github.com/milvus-io/milvus-proto/go-api/milvuspb" ) type RBACSuite struct { - suite.Suite - - lis *bufconn.Listener - svr *grpc.Server - mock *mocks.MilvusServiceServer - - client Client -} - -func (s *RBACSuite) SetupSuite() { - s.lis = bufconn.Listen(bufSize) - s.svr = grpc.NewServer() - - s.mock = &mocks.MilvusServiceServer{} - - server.RegisterMilvusServiceServer(s.svr, s.mock) - - go func() { - s.T().Log("start mock server") - if err := s.svr.Serve(s.lis); err != nil { - s.Fail("failed to server mock server", err.Error()) - } - }() -} - -func (s *RBACSuite) TearDownSuite() { - s.svr.Stop() - s.lis.Close() -} - -func (s *RBACSuite) mockDialer(context.Context, string) (net.Conn, error) { - return s.lis.Dial() -} - -func (s *RBACSuite) SetupTest() { - c, err := NewGrpcClient(context.Background(), "bufnet2", - grpc.WithBlock(), - grpc.WithInsecure(), - grpc.WithContextDialer(s.mockDialer), - ) - s.Require().NoError(err) - - s.client = c -} - -func (s *RBACSuite) TearDownTest() { - s.client.Close() - s.client = nil + MockSuiteBase } func (s *RBACSuite) TestCreateRole() { @@ -77,7 +27,7 @@ func (s *RBACSuite) TestCreateRole() { ctx, cancel := context.WithCancel(ctx) defer cancel() s.mock.ExpectedCalls = nil - s.mock.EXPECT().CreateRole(tmock.Anything, tmock.Anything).Run(func(ctx context.Context, req *server.CreateRoleRequest) { + s.mock.EXPECT().CreateRole(mock.Anything, mock.Anything).Run(func(ctx context.Context, req *server.CreateRoleRequest) { s.Equal(roleName, req.GetEntity().GetName()) }).Return(&common.Status{ ErrorCode: common.ErrorCode_Success, @@ -91,7 +41,7 @@ func (s *RBACSuite) TestCreateRole() { ctx, cancel := context.WithCancel(ctx) defer cancel() s.mock.ExpectedCalls = nil - s.mock.EXPECT().CreateRole(tmock.Anything, tmock.Anything).Return(nil, errors.New("mock error")) + s.mock.EXPECT().CreateRole(mock.Anything, mock.Anything).Return(nil, errors.New("mock error")) err := s.client.CreateRole(ctx, roleName) s.Error(err) @@ -101,7 +51,7 @@ func (s *RBACSuite) TestCreateRole() { ctx, cancel := context.WithCancel(ctx) defer cancel() s.mock.ExpectedCalls = nil - s.mock.EXPECT().CreateRole(tmock.Anything, tmock.Anything).Return(&common.Status{ + s.mock.EXPECT().CreateRole(mock.Anything, mock.Anything).Return(&common.Status{ ErrorCode: common.ErrorCode_UnexpectedError, }, nil) err := s.client.CreateRole(ctx, roleName) @@ -128,7 +78,7 @@ func (s *RBACSuite) TestDropRole() { ctx, cancel := context.WithCancel(ctx) defer cancel() s.mock.ExpectedCalls = nil - s.mock.EXPECT().DropRole(tmock.Anything, tmock.Anything).Run(func(ctx context.Context, req *server.DropRoleRequest) { + s.mock.EXPECT().DropRole(mock.Anything, mock.Anything).Run(func(ctx context.Context, req *server.DropRoleRequest) { s.Equal(roleName, req.GetRoleName()) }).Return(&common.Status{ ErrorCode: common.ErrorCode_Success, @@ -142,7 +92,7 @@ func (s *RBACSuite) TestDropRole() { ctx, cancel := context.WithCancel(ctx) defer cancel() s.mock.ExpectedCalls = nil - s.mock.EXPECT().DropRole(tmock.Anything, tmock.Anything).Return(nil, errors.New("mock error")) + s.mock.EXPECT().DropRole(mock.Anything, mock.Anything).Return(nil, errors.New("mock error")) err := s.client.DropRole(ctx, roleName) s.Error(err) @@ -152,7 +102,7 @@ func (s *RBACSuite) TestDropRole() { ctx, cancel := context.WithCancel(ctx) defer cancel() s.mock.ExpectedCalls = nil - s.mock.EXPECT().DropRole(tmock.Anything, tmock.Anything).Return(&common.Status{ + s.mock.EXPECT().DropRole(mock.Anything, mock.Anything).Return(&common.Status{ ErrorCode: common.ErrorCode_UnexpectedError, }, nil) err := s.client.DropRole(ctx, roleName) @@ -180,7 +130,7 @@ func (s *RBACSuite) TestAddUserRole() { ctx, cancel := context.WithCancel(ctx) defer cancel() s.mock.ExpectedCalls = nil - s.mock.EXPECT().OperateUserRole(tmock.Anything, tmock.Anything).Run(func(ctx context.Context, req *server.OperateUserRoleRequest) { + s.mock.EXPECT().OperateUserRole(mock.Anything, mock.Anything).Run(func(ctx context.Context, req *server.OperateUserRoleRequest) { s.Equal(server.OperateUserRoleType_AddUserToRole, req.GetType()) s.Equal(username, req.GetUsername()) s.Equal(roleName, req.GetRoleName()) @@ -196,7 +146,7 @@ func (s *RBACSuite) TestAddUserRole() { ctx, cancel := context.WithCancel(ctx) defer cancel() s.mock.ExpectedCalls = nil - s.mock.EXPECT().OperateUserRole(tmock.Anything, tmock.Anything).Return(nil, errors.New("mock error")) + s.mock.EXPECT().OperateUserRole(mock.Anything, mock.Anything).Return(nil, errors.New("mock error")) err := s.client.AddUserRole(ctx, username, roleName) s.Error(err) @@ -206,7 +156,7 @@ func (s *RBACSuite) TestAddUserRole() { ctx, cancel := context.WithCancel(ctx) defer cancel() s.mock.ExpectedCalls = nil - s.mock.EXPECT().OperateUserRole(tmock.Anything, tmock.Anything).Return(&common.Status{ + s.mock.EXPECT().OperateUserRole(mock.Anything, mock.Anything).Return(&common.Status{ ErrorCode: common.ErrorCode_UnexpectedError, }, nil) err := s.client.AddUserRole(ctx, username, roleName) @@ -234,7 +184,7 @@ func (s *RBACSuite) TestRemoveUserRole() { ctx, cancel := context.WithCancel(ctx) defer cancel() s.mock.ExpectedCalls = nil - s.mock.EXPECT().OperateUserRole(tmock.Anything, tmock.Anything).Run(func(ctx context.Context, req *server.OperateUserRoleRequest) { + s.mock.EXPECT().OperateUserRole(mock.Anything, mock.Anything).Run(func(ctx context.Context, req *server.OperateUserRoleRequest) { s.Equal(server.OperateUserRoleType_RemoveUserFromRole, req.GetType()) s.Equal(username, req.GetUsername()) s.Equal(roleName, req.GetRoleName()) @@ -250,7 +200,7 @@ func (s *RBACSuite) TestRemoveUserRole() { ctx, cancel := context.WithCancel(ctx) defer cancel() s.mock.ExpectedCalls = nil - s.mock.EXPECT().OperateUserRole(tmock.Anything, tmock.Anything).Return(nil, errors.New("mock error")) + s.mock.EXPECT().OperateUserRole(mock.Anything, mock.Anything).Return(nil, errors.New("mock error")) err := s.client.RemoveUserRole(ctx, username, roleName) s.Error(err) @@ -260,7 +210,7 @@ func (s *RBACSuite) TestRemoveUserRole() { ctx, cancel := context.WithCancel(ctx) defer cancel() s.mock.ExpectedCalls = nil - s.mock.EXPECT().OperateUserRole(tmock.Anything, tmock.Anything).Return(&common.Status{ + s.mock.EXPECT().OperateUserRole(mock.Anything, mock.Anything).Return(&common.Status{ ErrorCode: common.ErrorCode_UnexpectedError, }, nil) err := s.client.RemoveUserRole(ctx, username, roleName) @@ -287,7 +237,7 @@ func (s *RBACSuite) TestListRoles() { ctx, cancel := context.WithCancel(ctx) defer cancel() s.mock.ExpectedCalls = nil - s.mock.EXPECT().SelectRole(tmock.Anything, tmock.Anything).Run(func(ctx context.Context, req *server.SelectRoleRequest) { + s.mock.EXPECT().SelectRole(mock.Anything, mock.Anything).Run(func(ctx context.Context, req *server.SelectRoleRequest) { s.False(req.GetIncludeUserInfo()) }).Return(&server.SelectRoleResponse{ Status: &common.Status{ErrorCode: common.ErrorCode_Success}, @@ -309,7 +259,7 @@ func (s *RBACSuite) TestListRoles() { ctx, cancel := context.WithCancel(ctx) defer cancel() s.mock.ExpectedCalls = nil - s.mock.EXPECT().SelectRole(tmock.Anything, tmock.Anything).Return(nil, errors.New("mock error")) + s.mock.EXPECT().SelectRole(mock.Anything, mock.Anything).Return(nil, errors.New("mock error")) _, err := s.client.ListRoles(ctx) s.Error(err) @@ -319,7 +269,7 @@ func (s *RBACSuite) TestListRoles() { ctx, cancel := context.WithCancel(ctx) defer cancel() s.mock.ExpectedCalls = nil - s.mock.EXPECT().SelectRole(tmock.Anything, tmock.Anything).Return(&server.SelectRoleResponse{ + s.mock.EXPECT().SelectRole(mock.Anything, mock.Anything).Return(&server.SelectRoleResponse{ Status: &common.Status{ErrorCode: common.ErrorCode_UnexpectedError}, }, nil) @@ -346,7 +296,7 @@ func (s *RBACSuite) TestListUser() { ctx, cancel := context.WithCancel(ctx) defer cancel() s.mock.ExpectedCalls = nil - s.mock.EXPECT().SelectUser(tmock.Anything, tmock.Anything).Run(func(ctx context.Context, req *server.SelectUserRequest) { + s.mock.EXPECT().SelectUser(mock.Anything, mock.Anything).Run(func(ctx context.Context, req *server.SelectUserRequest) { s.False(req.GetIncludeRoleInfo()) }).Return(&server.SelectUserResponse{ Status: &common.Status{ErrorCode: common.ErrorCode_Success}, @@ -368,7 +318,7 @@ func (s *RBACSuite) TestListUser() { ctx, cancel := context.WithCancel(ctx) defer cancel() s.mock.ExpectedCalls = nil - s.mock.EXPECT().SelectUser(tmock.Anything, tmock.Anything).Return(nil, errors.New("mock error")) + s.mock.EXPECT().SelectUser(mock.Anything, mock.Anything).Return(nil, errors.New("mock error")) _, err := s.client.ListUsers(ctx) s.Error(err) @@ -378,7 +328,7 @@ func (s *RBACSuite) TestListUser() { ctx, cancel := context.WithCancel(ctx) defer cancel() s.mock.ExpectedCalls = nil - s.mock.EXPECT().SelectUser(tmock.Anything, tmock.Anything).Return(&server.SelectUserResponse{ + s.mock.EXPECT().SelectUser(mock.Anything, mock.Anything).Return(&server.SelectUserResponse{ Status: &common.Status{ErrorCode: common.ErrorCode_UnexpectedError}, }, nil) @@ -408,7 +358,7 @@ func (s *RBACSuite) TestGrant() { ctx, cancel := context.WithCancel(ctx) defer cancel() s.mock.ExpectedCalls = nil - s.mock.EXPECT().OperatePrivilege(tmock.Anything, tmock.Anything).Run(func(ctx context.Context, req *server.OperatePrivilegeRequest) { + s.mock.EXPECT().OperatePrivilege(mock.Anything, mock.Anything).Run(func(ctx context.Context, req *server.OperatePrivilegeRequest) { s.Equal(roleName, req.GetEntity().GetRole().GetName()) s.Equal(objectName, req.GetEntity().GetObjectName()) s.Equal(common.ObjectType_name[int32(objectType)], req.GetEntity().GetObject().GetName()) @@ -424,7 +374,7 @@ func (s *RBACSuite) TestGrant() { ctx, cancel := context.WithCancel(ctx) defer cancel() s.mock.ExpectedCalls = nil - s.mock.EXPECT().OperatePrivilege(tmock.Anything, tmock.Anything).Return(nil, errors.New("mock error")) + s.mock.EXPECT().OperatePrivilege(mock.Anything, mock.Anything).Return(nil, errors.New("mock error")) err := s.client.Grant(ctx, roleName, objectType, objectName) s.Error(err) @@ -434,7 +384,7 @@ func (s *RBACSuite) TestGrant() { ctx, cancel := context.WithCancel(ctx) defer cancel() s.mock.ExpectedCalls = nil - s.mock.EXPECT().OperatePrivilege(tmock.Anything, tmock.Anything).Return(&common.Status{ErrorCode: common.ErrorCode_UnexpectedError}, nil) + s.mock.EXPECT().OperatePrivilege(mock.Anything, mock.Anything).Return(&common.Status{ErrorCode: common.ErrorCode_UnexpectedError}, nil) err := s.client.Grant(ctx, roleName, objectType, objectName) s.Error(err) @@ -462,7 +412,7 @@ func (s *RBACSuite) TestRevoke() { ctx, cancel := context.WithCancel(ctx) defer cancel() s.mock.ExpectedCalls = nil - s.mock.EXPECT().OperatePrivilege(tmock.Anything, tmock.Anything).Run(func(ctx context.Context, req *server.OperatePrivilegeRequest) { + s.mock.EXPECT().OperatePrivilege(mock.Anything, mock.Anything).Run(func(ctx context.Context, req *server.OperatePrivilegeRequest) { s.Equal(roleName, req.GetEntity().GetRole().GetName()) s.Equal(objectName, req.GetEntity().GetObjectName()) s.Equal(common.ObjectType_name[int32(objectType)], req.GetEntity().GetObject().GetName()) @@ -478,7 +428,7 @@ func (s *RBACSuite) TestRevoke() { ctx, cancel := context.WithCancel(ctx) defer cancel() s.mock.ExpectedCalls = nil - s.mock.EXPECT().OperatePrivilege(tmock.Anything, tmock.Anything).Return(nil, errors.New("mock error")) + s.mock.EXPECT().OperatePrivilege(mock.Anything, mock.Anything).Return(nil, errors.New("mock error")) err := s.client.Revoke(ctx, roleName, objectType, objectName) s.Error(err) @@ -488,7 +438,7 @@ func (s *RBACSuite) TestRevoke() { ctx, cancel := context.WithCancel(ctx) defer cancel() s.mock.ExpectedCalls = nil - s.mock.EXPECT().OperatePrivilege(tmock.Anything, tmock.Anything).Return(&common.Status{ErrorCode: common.ErrorCode_UnexpectedError}, nil) + s.mock.EXPECT().OperatePrivilege(mock.Anything, mock.Anything).Return(&common.Status{ErrorCode: common.ErrorCode_UnexpectedError}, nil) err := s.client.Revoke(ctx, roleName, objectType, objectName) s.Error(err) diff --git a/client/client_grpc_row.go b/client/client_grpc_row.go index 99407f31..def4276c 100644 --- a/client/client_grpc_row.go +++ b/client/client_grpc_row.go @@ -2,10 +2,11 @@ package client import ( "context" - "errors" "fmt" "reflect" + "github.com/cockroachdb/errors" + "github.com/golang/protobuf/proto" server "github.com/milvus-io/milvus-proto/go-api/milvuspb" schema "github.com/milvus-io/milvus-proto/go-api/schemapb" diff --git a/client/client_grpc_row_test.go b/client/client_grpc_row_test.go index c484c823..dec1f4e5 100644 --- a/client/client_grpc_row_test.go +++ b/client/client_grpc_row_test.go @@ -2,11 +2,12 @@ package client import ( "context" - "errors" "fmt" "reflect" "testing" + "github.com/cockroachdb/errors" + "github.com/golang/protobuf/proto" common "github.com/milvus-io/milvus-proto/go-api/commonpb" server "github.com/milvus-io/milvus-proto/go-api/milvuspb" @@ -30,9 +31,9 @@ func TestCreateCollectionByRow(t *testing.T) { Vector []float32 `milvus:"dim:4"` } t.Run("Test normal creation", func(t *testing.T) { - mock.DelInjection(MHasCollection) + mockServer.DelInjection(MHasCollection) shardsNum := int32(1) - mock.SetInjection(MCreateCollection, func(ctx context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MCreateCollection, func(ctx context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.CreateCollectionRequest) if !ok { return &common.Status{ErrorCode: common.ErrorCode_IllegalArgument}, errors.New("illegal request type") @@ -52,7 +53,7 @@ func TestCreateCollectionByRow(t *testing.T) { t.Run("Invalid cases", func(t *testing.T) { //Duplicated m := make(map[string]struct{}) - mock.SetInjection(MCreateCollection, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MCreateCollection, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.CreateCollectionRequest) if !ok { return BadRequestStatus() @@ -61,7 +62,7 @@ func TestCreateCollectionByRow(t *testing.T) { return SuccessStatus() }) - mock.SetInjection(MHasCollection, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MHasCollection, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.HasCollectionRequest) resp := &server.BoolResponse{} if !ok { @@ -91,19 +92,19 @@ func TestInsertByRows(t *testing.T) { c := testClient(ctx, t) t.Run("test create failure due to meta", func(t *testing.T) { - mock.DelInjection(MHasCollection) // collection does not exist + mockServer.DelInjection(MHasCollection) // collection does not exist ids, err := c.InsertByRows(ctx, testCollectionName, "", []entity.Row{}) assert.Nil(t, ids) assert.NotNil(t, err) // partition not exists - mock.SetInjection(MHasCollection, hasCollectionDefault) + mockServer.SetInjection(MHasCollection, hasCollectionDefault) ids, err = c.InsertByRows(ctx, testCollectionName, "_part_not_exists", []entity.Row{}) assert.Nil(t, ids) assert.NotNil(t, err) // field not in collection - mock.SetInjection(MDescribeCollection, describeCollectionInjection(t, 0, testCollectionName, defaultSchema())) + mockServer.SetInjection(MDescribeCollection, describeCollectionInjection(t, 0, testCollectionName, defaultSchema())) type ExtraFieldRow struct { entity.RowBase Int64 int64 `milvus:"primary_key"` @@ -115,7 +116,7 @@ func TestInsertByRows(t *testing.T) { assert.NotNil(t, err) // field type not match - mock.SetInjection(MDescribeCollection, describeCollectionInjection(t, 0, testCollectionName, defaultSchema())) + mockServer.SetInjection(MDescribeCollection, describeCollectionInjection(t, 0, testCollectionName, defaultSchema())) type OtherFieldRow struct { entity.RowBase Int64 int32 `milvus:"primary_key;name:int64"` @@ -155,11 +156,11 @@ func TestInsertByRows(t *testing.T) { t.Log(err.Error()) }) - mock.SetInjection(MHasCollection, hasCollectionDefault) - mock.SetInjection(MDescribeCollection, describeCollectionInjection(t, 0, testCollectionName, defaultSchema())) + mockServer.SetInjection(MHasCollection, hasCollectionDefault) + mockServer.SetInjection(MDescribeCollection, describeCollectionInjection(t, 0, testCollectionName, defaultSchema())) vector := generateFloatVector(4096, testVectorDim) - mock.SetInjection(MInsert, func(_ context.Context, raw proto.Message) (proto.Message, error) { + mockServer.SetInjection(MInsert, func(_ context.Context, raw proto.Message) (proto.Message, error) { req, ok := raw.(*server.InsertRequest) resp := &server.MutationResult{} if !ok { diff --git a/client/client_mock.go b/client/client_mock_test.go similarity index 94% rename from client/client_mock.go rename to client/client_mock_test.go index 283e35af..eb1819a4 100644 --- a/client/client_mock.go +++ b/client/client_mock_test.go @@ -2,14 +2,71 @@ package client import ( "context" - "errors" + "net" "sync" + "github.com/cockroachdb/errors" + "github.com/golang/protobuf/proto" common "github.com/milvus-io/milvus-proto/go-api/commonpb" server "github.com/milvus-io/milvus-proto/go-api/milvuspb" + "github.com/milvus-io/milvus-sdk-go/v2/mocks" + "github.com/stretchr/testify/suite" + "google.golang.org/grpc" + "google.golang.org/grpc/test/bufconn" ) +type MockSuiteBase struct { + suite.Suite + + lis *bufconn.Listener + svr *grpc.Server + mock *mocks.MilvusServiceServer + + client Client +} + +func (s *MockSuiteBase) SetupSuite() { + s.lis = bufconn.Listen(bufSize) + s.svr = grpc.NewServer() + + s.mock = &mocks.MilvusServiceServer{} + + server.RegisterMilvusServiceServer(s.svr, s.mock) + + go func() { + s.T().Log("start mock server") + if err := s.svr.Serve(s.lis); err != nil { + s.Fail("failed to server mock server", err.Error()) + } + }() +} + +func (s *MockSuiteBase) TearDownSuite() { + s.svr.Stop() + s.lis.Close() +} + +func (s *MockSuiteBase) mockDialer(context.Context, string) (net.Conn, error) { + return s.lis.Dial() +} + +func (s *MockSuiteBase) SetupTest() { + c, err := NewGrpcClient(context.Background(), "bufnet2", + grpc.WithBlock(), + grpc.WithInsecure(), + grpc.WithContextDialer(s.mockDialer), + ) + s.Require().NoError(err) + + s.client = c +} + +func (s *MockSuiteBase) TearDownTest() { + s.client.Close() + s.client = nil +} + // ref https://stackoverflow.com/questions/42102496/testing-a-grpc-service var ( diff --git a/client/client_test.go b/client/client_test.go index 4db7a262..6778e186 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -30,8 +30,8 @@ const ( ) var ( - lis *bufconn.Listener - mock *MockServer + lis *bufconn.Listener + mockServer *MockServer ) const ( @@ -111,10 +111,10 @@ func TestMain(m *testing.M) { rand.Seed(time.Now().Unix()) lis = bufconn.Listen(bufSize) s := grpc.NewServer() - mock = &MockServer{ + mockServer = &MockServer{ Injections: make(map[ServiceMethod]TestInjection), } - server.RegisterMilvusServiceServer(s, mock) + server.RegisterMilvusServiceServer(s, mockServer) go func() { if err := s.Serve(lis); err != nil { log.Fatalf("Server exited with error: %v", err) diff --git a/client/errors.go b/client/errors.go index fb0bc845..b431e915 100644 --- a/client/errors.go +++ b/client/errors.go @@ -12,8 +12,9 @@ package client import ( - "errors" "fmt" + + "github.com/cockroachdb/errors" ) // ErrServiceFailed indicates error returns from milvus Service diff --git a/go.mod b/go.mod index 67ed5662..e85e729a 100644 --- a/go.mod +++ b/go.mod @@ -12,8 +12,17 @@ require ( ) require ( + github.com/cockroachdb/errors v1.9.1 // indirect + github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f // indirect + github.com/cockroachdb/redact v1.1.3 // indirect github.com/davecgh/go-spew v1.1.1 // indirect + github.com/getsentry/sentry-go v0.12.0 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/kr/pretty v0.3.0 // indirect + github.com/kr/text v0.2.0 // indirect + github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/rogpeppe/go-internal v1.8.1 // indirect github.com/stretchr/objx v0.5.0 // indirect golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect diff --git a/go.sum b/go.sum index 1f3248b2..bfa06d1f 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,15 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53/go.mod h1:+3IMCy2vIlbG1XG/0ggNQv0SvxCAIpPM5b1nCz56Xno= +github.com/CloudyKit/jet/v3 v3.0.0/go.mod h1:HKQPgSJmdK8hdoAbKUUWajkHyHo4RaU5rMdUywE7VMo= +github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY= +github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0= +github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= @@ -11,23 +19,63 @@ github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XP github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cockroachdb/datadriven v1.0.2/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= +github.com/cockroachdb/errors v1.9.1 h1:yFVvsI0VxmRShfawbt/laCIDy/mtTqqnvoNgiy5bEV8= +github.com/cockroachdb/errors v1.9.1/go.mod h1:2sxOtL2WIc096WSZqZ5h8fa17rdDq9HZOZLBCor4mBk= +github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f h1:6jduT9Hfc0njg5jJ1DdKCFPdMBrp/mdZfCpa5h+WM74= +github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= +github.com/cockroachdb/redact v1.1.3 h1:AKZds10rFSIj7qADf0g46UixK8NNLwWTNdCIGS5wfSQ= +github.com/cockroachdb/redact v1.1.3/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= +github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= +github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8= +github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc= +github.com/getsentry/sentry-go v0.12.0 h1:era7g0re5iY13bHSdN/xMkyV+5zZppjRVQhZrXCaEIk= +github.com/getsentry/sentry-go v0.12.0/go.mod h1:NSap0JBYWzHND8oMbyi0+XZhUalc1TBdRL1M71JZW2c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= +github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/3rZdM= +github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= +github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= +github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= +github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= +github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4= +github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/gogo/status v1.1.0/go.mod h1:BFv9nrluPLmrS0EmGVvLaPNmRosr9KapBYd5/hpY1WM= +github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= @@ -41,6 +89,7 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/gomodule/redigo v1.7.1-0.20190724094224-574c33c3df38/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -49,29 +98,113 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/hydrogen18/memlistener v0.0.0-20200120041712-dcc25e7acd91/go.mod h1:qEIFzExnS6016fRpRfxrExeVn2gbClQA99gQhnIcdhE= +github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/iris-contrib/blackfriday v2.0.0+incompatible/go.mod h1:UzZ2bDEoaSGPbkg6SAB4att1aAwTmVIx/5gCVqeyUdI= +github.com/iris-contrib/go.uuid v2.0.0+incompatible/go.mod h1:iz2lgM/1UnEf1kP0L/+fafWORmlnuysV2EMP8MW+qe0= +github.com/iris-contrib/jade v1.1.3/go.mod h1:H/geBymxJhShH5kecoiOCSssPX7QWYH7UaeZTSWddIk= +github.com/iris-contrib/pongo2 v0.0.1/go.mod h1:Ssh+00+3GAZqSQb30AvBRNxBx7rf0GqwkjqxNd0u65g= +github.com/iris-contrib/schema v0.0.1/go.mod h1:urYA3uvUNG1TIIjOSCzHr9/LmbQo8LrOcOqfqxa4hXw= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= +github.com/kataras/golog v0.0.10/go.mod h1:yJ8YKCmyL+nWjERB90Qwn+bdyBZsaQwU3bTVFgkFIp8= +github.com/kataras/iris/v12 v12.1.8/go.mod h1:LMYy4VlP67TQ3Zgriz8RE2h2kMZV2SgMYbq3UhfoFmE= +github.com/kataras/neffos v0.0.14/go.mod h1:8lqADm8PnbeFfL7CLXh1WHw53dG27MC3pgi2R1rmoTE= +github.com/kataras/pio v0.0.2/go.mod h1:hAoW0t9UmXi4R5Oyq5Z4irTbaTsOemSrDGUtaTl7Dro= +github.com/kataras/sitemap v0.0.5/go.mod h1:KY2eugMKiPwsJgx7+U103YZehfvNGOXURubcGyk0Bz8= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/klauspost/compress v1.9.7/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/labstack/echo/v4 v4.5.0/go.mod h1:czIriw4a0C1dFun+ObrXp7ok03xON0N1awStJ6ArI7Y= +github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= +github.com/mediocregopher/radix/v3 v3.4.2/go.mod h1:8FL3F6UQRXHXIBSPUs5h0RybMF8i4n7wVopoX3x7Bv8= +github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc= github.com/milvus-io/milvus-proto/go-api v0.0.0-20230105121931-9f9303dcc729 h1:hsb1ifdNe3qlXi1YY5dWPPzWMNZmnqe5uunYPYK3gd0= github.com/milvus-io/milvus-proto/go-api v0.0.0-20230105121931-9f9303dcc729/go.mod h1:148qnlmZ0Fdm1Fq+Mj/OW2uDoEP25g3mjh0vMGtkgmk= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ= +github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= +github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= +github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.8.1 h1:geMPLpDpQOgVyCg5z5GoRwLHepNdb71NXb67XFkP+Eg= +github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/schollz/closestmatch v2.1.0+incompatible/go.mod h1:RtP1ddjLong6gTkbtmuhtR2uUrrJOpYzYRvbcPAid+g= +github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= @@ -79,36 +212,69 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= +github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= +github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasthttp v1.6.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w= +github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= +github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= +github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= +github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0/go.mod h1:/LWChgwKmvncFJFHJ7Gvn9wZArjbV5/FppcK2fKk/tI= +github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FBNExI05xg= +github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM= +github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZkTdatxwunjIkc= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190327091125-710a502c58a2/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20211008194852-3b03d305991f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacpb0ZVXA5rIwylE2Xchk= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0= @@ -118,22 +284,37 @@ golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4Iltr golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s= @@ -141,19 +322,27 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8 h1:nAL+RVCQ9uMn3vJZbV+MRnydTJFPf8qqY42YiA6MrqY= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= +golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181221001348-537d06c36207/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190327201419-c70d86f8b7cf/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -162,14 +351,17 @@ golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1N golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180518175338-11a468237815/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20200806141610-86f49bd18e98/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= google.golang.org/genproto v0.0.0-20220503193339-ba3ae3f07e29 h1:DJUvgAPiJWeMBiT+RzBVcJGQN7bAEWS5UEoMshES9xs= google.golang.org/genproto v0.0.0-20220503193339-ba3ae3f07e29/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= +google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= @@ -177,6 +369,7 @@ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc v1.48.0 h1:rQOsyJ/8+ufEDJd/Gdsz7HG220Mh9HAhFHRGnIjda0w= google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= @@ -200,9 +393,22 @@ google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175 google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= +gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y= +gopkg.in/ini.v1 v1.51.1/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20191120175047-4206685974f2/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=