diff --git a/client/collection.go b/client/collection.go index 748d7015..6fbec973 100644 --- a/client/collection.go +++ b/client/collection.go @@ -288,9 +288,6 @@ func (c *GrpcClient) DropCollection(ctx context.Context, collName string, opts . if c.Service == nil { return ErrClientNotReady } - if err := c.checkCollectionExists(ctx, collName); err != nil { - return err - } req := &milvuspb.DropCollectionRequest{ CollectionName: collName, @@ -337,10 +334,6 @@ func (c *GrpcClient) GetCollectionStatistics(ctx context.Context, collName strin return nil, ErrClientNotReady } - if err := c.checkCollectionExists(ctx, collName); err != nil { - return nil, err - } - req := &milvuspb.GetCollectionStatisticsRequest{ CollectionName: collName, } @@ -359,10 +352,6 @@ func (c *GrpcClient) ShowCollection(ctx context.Context, collName string) (*enti if c.Service == nil { return nil, ErrClientNotReady } - if err := c.checkCollectionExists(ctx, collName); err != nil { - return nil, err - } - req := &milvuspb.ShowCollectionsRequest{ Type: milvuspb.ShowType_InMemory, CollectionNames: []string{collName}, @@ -391,10 +380,6 @@ func (c *GrpcClient) RenameCollection(ctx context.Context, collName, newName str return ErrClientNotReady } - if err := c.checkCollectionExists(ctx, collName); err != nil { - return err - } - req := &milvuspb.RenameCollectionRequest{ OldName: collName, NewName: newName, @@ -412,10 +397,6 @@ func (c *GrpcClient) LoadCollection(ctx context.Context, collName string, async return ErrClientNotReady } - if err := c.checkCollectionExists(ctx, collName); err != nil { - return err - } - req := &milvuspb.LoadCollectionRequest{ CollectionName: collName, ReplicaNumber: 1, // default replica number @@ -459,9 +440,6 @@ func (c *GrpcClient) ReleaseCollection(ctx context.Context, collName string, opt if c.Service == nil { return ErrClientNotReady } - if err := c.checkCollectionExists(ctx, collName); err != nil { - return err - } req := &milvuspb.ReleaseCollectionRequest{ DbName: "", // reserved @@ -525,9 +503,6 @@ func (c *GrpcClient) GetLoadingProgress(ctx context.Context, collName string, pa if c.Service == nil { return 0, ErrClientNotReady } - if err := c.checkCollectionExists(ctx, collName); err != nil { - return 0, err - } req := &milvuspb.GetLoadingProgressRequest{ CollectionName: collName, @@ -546,10 +521,6 @@ func (c *GrpcClient) GetLoadState(ctx context.Context, collName string, partitio if c.Service == nil { return 0, ErrClientNotReady } - if err := c.checkCollectionExists(ctx, collName); err != nil { - return 0, err - } - req := &milvuspb.GetLoadStateRequest{ CollectionName: collName, PartitionNames: partitionNames, @@ -567,9 +538,6 @@ func (c *GrpcClient) AlterCollection(ctx context.Context, collName string, attrs if c.Service == nil { return ErrClientNotReady } - if err := c.checkCollectionExists(ctx, collName); err != nil { - return err - } if len(attrs) == 0 { return errors.New("no collection attribute provided") diff --git a/client/collection_test.go b/client/collection_test.go index fc144b35..edfe788d 100644 --- a/client/collection_test.go +++ b/client/collection_test.go @@ -399,17 +399,6 @@ func (s *CollectionSuite) TestRenameCollection() { s.NoError(err) }) - s.Run("coll_not_exist", func() { - defer s.resetMock() - - newCollName := fmt.Sprintf("new_%s", randStr(6)) - - s.mock.EXPECT().HasCollection(mock.Anything, &milvuspb.HasCollectionRequest{CollectionName: testCollectionName}).Return(&milvuspb.BoolResponse{Status: &commonpb.Status{}, Value: false}, nil) - - err := c.RenameCollection(ctx, testCollectionName, newCollName) - s.Error(err) - }) - s.Run("rename_failed", func() { defer s.resetMock() @@ -451,19 +440,6 @@ func (s *CollectionSuite) TestAlterCollection() { s.NoError(err) }) - s.Run("collection_not_exist", func() { - defer s.resetMock() - - s.mock.EXPECT().HasCollection(mock.Anything, mock.AnythingOfType("*milvuspb.HasCollectionRequest")). - Return(&milvuspb.BoolResponse{ - Status: &commonpb.Status{}, - Value: false, - }, nil) - - err := c.AlterCollection(ctx, testCollectionName, entity.CollectionTTL(100000)) - s.Error(err) - }) - s.Run("no_attributes", func() { defer s.resetMock() @@ -562,26 +538,6 @@ func (s *CollectionSuite) TestLoadCollection() { s.NoError(err) }) - s.Run("has_collection_failure", func() { - s.Run("return_false", func() { - defer s.resetMock() - s.mock.EXPECT().HasCollection(mock.Anything, &milvuspb.HasCollectionRequest{CollectionName: testCollectionName}). - Return(&milvuspb.BoolResponse{Status: &commonpb.Status{}, Value: false}, nil) - - err := c.LoadCollection(ctx, testCollectionName, true) - s.Error(err) - }) - - s.Run("return_error", func() { - defer s.resetMock() - s.mock.EXPECT().HasCollection(mock.Anything, &milvuspb.HasCollectionRequest{CollectionName: testCollectionName}). - Return(nil, errors.New("mock error")) - - err := c.LoadCollection(ctx, testCollectionName, true) - s.Error(err) - }) - }) - s.Run("load_collection_failure", func() { s.Run("failure_status", func() { defer s.resetMock() @@ -874,11 +830,6 @@ func TestGrpcClientGetReplicas(t *testing.T) { assert.Equal(t, 2, len(groups[0].ShardReplicas)) }) - t.Run("get replicas invalid name", func(t *testing.T) { - _, err := c.GetReplicas(ctx, "invalid name") - assert.Error(t, err) - }) - t.Run("get replicas grpc error", func(t *testing.T) { mockServer.SetInjection(MGetReplicas, func(ctx context.Context, raw proto.Message) (proto.Message, error) { return &milvuspb.GetReplicasResponse{}, errors.New("mockServer.d grpc error") diff --git a/client/data.go b/client/data.go index d40c45df..0bd1a333 100644 --- a/client/data.go +++ b/client/data.go @@ -421,15 +421,6 @@ func (c *GrpcClient) CalcDistance(ctx context.Context, collName string, partitio return nil, errors.New("operators cannot be nil") } - // check meta - if err := c.checkCollectionExists(ctx, collName); err != nil { - return nil, err - } - for _, partition := range partitions { - if err := c.checkPartitionExists(ctx, collName, partition); err != nil { - return nil, err - } - } if err := c.checkCollField(ctx, collName, opLeft.Name(), isVectorField); err != nil { return nil, err } diff --git a/client/data_test.go b/client/data_test.go index 8e2748d6..a4dcc51b 100644 --- a/client/data_test.go +++ b/client/data_test.go @@ -225,16 +225,8 @@ func TestGrpcDeleteByPks(t *testing.T) { 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{})) - assert.Error(t, err) - - // non-exist parition - err = c.DeleteByPks(ctx, testCollectionName, "non-exists-part", entity.NewColumnInt64("pk", []int64{})) - assert.Error(t, err) - // zero length pk - err = c.DeleteByPks(ctx, testCollectionName, "", entity.NewColumnInt64(testPrimaryField, []int64{})) + err := c.DeleteByPks(ctx, testCollectionName, "", entity.NewColumnInt64(testPrimaryField, []int64{})) assert.Error(t, err) // string pk field @@ -299,19 +291,6 @@ func TestGrpcDelete(t *testing.T) { assert.NoError(t, err) }) - t.Run("Bad request deletes", func(t *testing.T) { - partName := "testPart" - mockServer.SetInjection(MHasPartition, hasPartitionInjection(t, testCollectionName, false, partName)) - defer mockServer.DelInjection(MHasPartition) - - // non-exist collection - err := c.Delete(ctx, "non-exists-collection", "", "") - assert.Error(t, err) - - // non-exist parition - err = c.Delete(ctx, testCollectionName, "non-exists-part", "") - assert.Error(t, err) - }) t.Run("delete services fail", func(t *testing.T) { mockServer.SetInjection(MDelete, func(_ context.Context, raw proto.Message) (proto.Message, error) { resp := &milvuspb.MutationResult{} diff --git a/client/insert.go b/client/insert.go index fe24db40..020b44e3 100644 --- a/client/insert.go +++ b/client/insert.go @@ -34,17 +34,7 @@ func (c *GrpcClient) Insert(ctx context.Context, collName string, partitionName if c.Service == nil { return nil, ErrClientNotReady } - // 1. validation for all input params - // collection - if err := c.checkCollectionExists(ctx, collName); err != nil { - return nil, err - } - if partitionName != "" { - err := c.checkPartitionExists(ctx, collName, partitionName) - if err != nil { - return nil, err - } - } + // fields var rowSize int coll, err := c.DescribeCollection(ctx, collName) @@ -201,9 +191,7 @@ func (c *GrpcClient) FlushV2(ctx context.Context, collName string, async bool, o if c.Service == nil { return nil, nil, 0, ErrClientNotReady } - if err := c.checkCollectionExists(ctx, collName); err != nil { - return nil, nil, 0, err - } + req := &milvuspb.FlushRequest{ DbName: "", // reserved, CollectionNames: []string{collName}, @@ -252,21 +240,11 @@ func (c *GrpcClient) DeleteByPks(ctx context.Context, collName string, partition return ErrClientNotReady } - // check collection name - if err := c.checkCollectionExists(ctx, collName); err != nil { - return err - } coll, err := c.DescribeCollection(ctx, collName) if err != nil { return err } - // check partition name - if partitionName != "" { - err := c.checkPartitionExists(ctx, collName, partitionName) - if err != nil { - return err - } - } + // check primary keys if ids.Len() == 0 { return errors.New("ids len must not be zero") @@ -308,19 +286,6 @@ func (c *GrpcClient) Delete(ctx context.Context, collName string, partitionName return ErrClientNotReady } - // check collection name - if err := c.checkCollectionExists(ctx, collName); err != nil { - return err - } - - // check partition name - if partitionName != "" { - err := c.checkPartitionExists(ctx, collName, partitionName) - if err != nil { - return err - } - } - req := &milvuspb.DeleteRequest{ DbName: "", CollectionName: collName, @@ -348,17 +313,7 @@ func (c *GrpcClient) Upsert(ctx context.Context, collName string, partitionName if c.Service == nil { return nil, ErrClientNotReady } - // 1. validation for all input params - // collection - if err := c.checkCollectionExists(ctx, collName); err != nil { - return nil, err - } - if partitionName != "" { - err := c.checkPartitionExists(ctx, collName, partitionName) - if err != nil { - return nil, err - } - } + // fields var rowSize int coll, err := c.DescribeCollection(ctx, collName) diff --git a/client/insert_test.go b/client/insert_test.go index 55031942..e1413586 100644 --- a/client/insert_test.go +++ b/client/insert_test.go @@ -33,22 +33,6 @@ func (s *InsertSuite) TestInsertFail() { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - s.Run("collection_not_exist", func() { - defer s.resetMock() - s.setupHasCollection() - _, err := c.Insert(ctx, testCollectionName, "") - s.Error(err) - }) - - s.Run("partition_not_exist", func() { - defer s.resetMock() - s.setupHasCollection(testCollectionName) - s.setupHasPartition(testCollectionName) - - _, err := c.Insert(ctx, testCollectionName, "partition_name") - s.Error(err) - }) - s.Run("field_not_exist", func() { defer s.resetMock() s.setupHasCollection(testCollectionName) diff --git a/client/partition.go b/client/partition.go index d0f95ac2..1b748090 100644 --- a/client/partition.go +++ b/client/partition.go @@ -13,7 +13,6 @@ package client import ( "context" - "fmt" "time" "github.com/cockroachdb/errors" @@ -28,16 +27,6 @@ func (c *GrpcClient) CreatePartition(ctx context.Context, collName string, parti if c.Service == nil { return ErrClientNotReady } - if err := c.checkCollectionExists(ctx, collName); err != nil { - return err - } - has, err := c.HasPartition(ctx, collName, partitionName) - if err != nil { - return err - } - if has { - return fmt.Errorf("partition %s of collection %s already exists", partitionName, collName) - } req := &milvuspb.CreatePartitionRequest{ DbName: "", //reserved @@ -70,12 +59,6 @@ func (c *GrpcClient) DropPartition(ctx context.Context, collName string, partiti if c.Service == nil { return ErrClientNotReady } - if err := c.checkCollectionExists(ctx, collName); err != nil { - return err - } - if err := c.checkPartitionExists(ctx, collName, partitionName); err != nil { - return err - } req := &milvuspb.DropPartitionRequest{ DbName: "", CollectionName: collName, @@ -147,15 +130,6 @@ func (c *GrpcClient) LoadPartitions(ctx context.Context, collName string, partit if c.Service == nil { return ErrClientNotReady } - if err := c.checkCollectionExists(ctx, collName); err != nil { - return err - } - for _, partitionName := range partitionNames { - if err := c.checkPartitionExists(ctx, collName, partitionName); err != nil { - return err - } - } - req := &milvuspb.LoadPartitionsRequest{ DbName: "", // reserved CollectionName: collName, @@ -200,14 +174,7 @@ func (c *GrpcClient) ReleasePartitions(ctx context.Context, collName string, par if c.Service == nil { return ErrClientNotReady } - if err := c.checkCollectionExists(ctx, collName); err != nil { - return err - } - for _, partitionName := range partitionNames { - if err := c.checkPartitionExists(ctx, collName, partitionName); err != nil { - return err - } - } + req := &milvuspb.ReleasePartitionsRequest{ DbName: "", // reserved CollectionName: collName, diff --git a/client/partition_test.go b/client/partition_test.go index 588eb427..63e63919 100644 --- a/client/partition_test.go +++ b/client/partition_test.go @@ -301,88 +301,6 @@ func (s *PartitionSuite) TestLoadPartitions() { s.NoError(err) }) - s.Run("has_collection_failure", func() { - s.Run("return_false", func() { - defer s.resetMock() - s.mock.EXPECT().HasCollection(mock.Anything, &milvuspb.HasCollectionRequest{CollectionName: testCollectionName}). - Return(&milvuspb.BoolResponse{Status: &commonpb.Status{}, Value: false}, nil) - - err := c.LoadPartitions(ctx, testCollectionName, partNames, false) - s.Error(err) - }) - - s.Run("return_error", func() { - defer s.resetMock() - s.mock.EXPECT().HasCollection(mock.Anything, &milvuspb.HasCollectionRequest{CollectionName: testCollectionName}). - Return(nil, errors.New("mock error")) - - err := c.LoadPartitions(ctx, testCollectionName, partNames, false) - s.Error(err) - }) - }) - - s.Run("has_partition_failure", func() { - s.Run("return_false", func() { - defer s.resetMock() - s.mock.EXPECT().HasCollection(mock.Anything, &milvuspb.HasCollectionRequest{CollectionName: testCollectionName}). - Return(&milvuspb.BoolResponse{Status: &commonpb.Status{}, Value: true}, nil) - s.mock.EXPECT().HasPartition(mock.Anything, mock.Anything). - Return(&milvuspb.BoolResponse{Status: &commonpb.Status{}, Value: false}, nil) - - err := c.LoadPartitions(ctx, testCollectionName, partNames, false) - s.Error(err) - }) - - s.Run("return_error", func() { - defer s.resetMock() - s.mock.EXPECT().HasCollection(mock.Anything, &milvuspb.HasCollectionRequest{CollectionName: testCollectionName}). - Return(&milvuspb.BoolResponse{Status: &commonpb.Status{}, Value: true}, nil) - s.mock.EXPECT().HasPartition(mock.Anything, mock.Anything). - Return(nil, errors.New("mock")) - - err := c.LoadPartitions(ctx, testCollectionName, partNames, false) - s.Error(err) - }) - }) - - s.Run("load_partitions_failure", func() { - s.Run("fail_status_code", func() { - defer s.resetMock() - s.mock.EXPECT().HasCollection(mock.Anything, &milvuspb.HasCollectionRequest{CollectionName: testCollectionName}). - Return(&milvuspb.BoolResponse{Status: &commonpb.Status{}, Value: true}, nil) - s.mock.EXPECT().HasPartition(mock.Anything, mock.Anything).Run(func(_ context.Context, req *milvuspb.HasPartitionRequest) { - s.Equal(testCollectionName, req.GetCollectionName()) - _, ok := mPartNames[req.GetPartitionName()] - s.True(ok) - }).Return(&milvuspb.BoolResponse{Status: &commonpb.Status{}, Value: true}, nil) - s.mock.EXPECT().LoadPartitions(mock.Anything, mock.Anything).Run(func(_ context.Context, req *milvuspb.LoadPartitionsRequest) { - s.Equal(testCollectionName, req.GetCollectionName()) - s.ElementsMatch(partNames, req.GetPartitionNames()) - }).Return(&commonpb.Status{ErrorCode: commonpb.ErrorCode_UnexpectedError}, nil) - - err := c.LoadPartitions(ctx, testCollectionName, partNames, true) - s.Error(err) - }) - - s.Run("return_error", func() { - defer s.resetMock() - s.mock.EXPECT().HasCollection(mock.Anything, &milvuspb.HasCollectionRequest{CollectionName: testCollectionName}). - Return(&milvuspb.BoolResponse{Status: &commonpb.Status{}, Value: true}, nil) - s.mock.EXPECT().HasPartition(mock.Anything, mock.Anything).Run(func(_ context.Context, req *milvuspb.HasPartitionRequest) { - s.Equal(testCollectionName, req.GetCollectionName()) - _, ok := mPartNames[req.GetPartitionName()] - s.True(ok) - }).Return(&milvuspb.BoolResponse{Status: &commonpb.Status{}, Value: true}, nil) - s.mock.EXPECT().LoadPartitions(mock.Anything, mock.Anything).Run(func(_ context.Context, req *milvuspb.LoadPartitionsRequest) { - s.Equal(testCollectionName, req.GetCollectionName()) - s.ElementsMatch(partNames, req.GetPartitionNames()) - }).Return(&commonpb.Status{ErrorCode: commonpb.ErrorCode_UnexpectedError}, nil) - - err := c.LoadPartitions(ctx, testCollectionName, partNames, true) - s.Error(err) - }) - }) - s.Run("get_loading_progress_failure", func() { defer s.resetMock() s.mock.EXPECT().HasCollection(mock.Anything, &milvuspb.HasCollectionRequest{CollectionName: testCollectionName}). diff --git a/client/row.go b/client/row.go index 42001ea7..e5750020 100644 --- a/client/row.go +++ b/client/row.go @@ -80,14 +80,6 @@ func (c *GrpcClient) InsertRows(ctx context.Context, collName string, partitionN return nil, errors.New("empty rows provided") } - if err := c.checkCollectionExists(ctx, collName); err != nil { - return nil, err - } - if partitionName != "" { - if err := c.checkPartitionExists(ctx, collName, partitionName); err != nil { - return nil, err - } - } coll, err := c.DescribeCollection(ctx, collName) if err != nil { return nil, err diff --git a/client/row_test.go b/client/row_test.go index e69479d1..f0d76f21 100644 --- a/client/row_test.go +++ b/client/row_test.go @@ -106,51 +106,6 @@ func (s *InsertByRowsSuite) TestFails() { s.Error(err) }) - s.Run("fail_collection_not_found", func() { - defer s.resetMock() - s.setupHasCollection() - _, err := c.InsertByRows(ctx, testCollectionName, partName, []entity.Row{entity.RowBase{}}) - s.Error(err) - }) - - s.Run("fail_hascollection_errcode", func() { - defer s.resetMock() - s.setupHasCollectionError(commonpb.ErrorCode_UnexpectedError, nil) - _, err := c.InsertByRows(ctx, testCollectionName, partName, []entity.Row{entity.RowBase{}}) - s.Error(err) - }) - - s.Run("fail_hascollection_error", func() { - defer s.resetMock() - s.setupHasCollectionError(commonpb.ErrorCode_Success, errors.New("mock error")) - _, err := c.InsertByRows(ctx, testCollectionName, partName, []entity.Row{entity.RowBase{}}) - s.Error(err) - }) - - s.Run("fail_partition_not_found", func() { - defer s.resetMock() - s.setupHasCollection(testCollectionName) - s.setupHasPartition(testCollectionName) - _, err := c.InsertByRows(ctx, testCollectionName, partName, []entity.Row{entity.RowBase{}}) - s.Error(err) - }) - - s.Run("fail_haspartition_error", func() { - defer s.resetMock() - s.setupHasCollection(testCollectionName) - s.setupHasPartitionError(commonpb.ErrorCode_Success, errors.New("mock error")) - _, err := c.InsertByRows(ctx, testCollectionName, partName, []entity.Row{entity.RowBase{}}) - s.Error(err) - }) - - s.Run("fail_haspartition_errcode", func() { - defer s.resetMock() - s.setupHasCollection(testCollectionName) - s.setupHasPartitionError(commonpb.ErrorCode_UnexpectedError, nil) - _, err := c.InsertByRows(ctx, testCollectionName, partName, []entity.Row{entity.RowBase{}}) - s.Error(err) - }) - s.Run("fail_describecollection_error", func() { defer s.resetMock() s.setupHasCollection(testCollectionName) diff --git a/go.mod b/go.mod index c540c693..1091b5ce 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,7 @@ require ( github.com/go-faker/faker/v4 v4.1.0 github.com/golang/protobuf v1.5.2 github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 + github.com/klauspost/compress v1.9.7 github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4 github.com/stretchr/testify v1.8.1 github.com/tidwall/gjson v1.14.4 diff --git a/go.sum b/go.sum index b1881d75..e28f55a8 100644 --- a/go.sum +++ b/go.sum @@ -132,6 +132,7 @@ github.com/kataras/sitemap v0.0.5/go.mod h1:KY2eugMKiPwsJgx7+U103YZehfvNGOXURubc 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 h1:hYW1gP94JUmAhBtJ+LNz5My+gBobDxPR1iVuKug26aA= 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= @@ -157,10 +158,6 @@ github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27k 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/v2 v2.3.2 h1:tBcKiEUcX6i3MaFYvMJO1F7R6fIoeLFkg1kSGE1Tvpk= -github.com/milvus-io/milvus-proto/go-api/v2 v2.3.2/go.mod h1:1OIl0v5PQeNxIJhCvY+K55CBUOYDZevw9g9380u1Wek= -github.com/milvus-io/milvus-proto/go-api/v2 v2.3.3 h1:j6Ru7Lq421Ukp+XH8I+ny7dsVF2rLDLLoWpuFgoDZLM= -github.com/milvus-io/milvus-proto/go-api/v2 v2.3.3/go.mod h1:1OIl0v5PQeNxIJhCvY+K55CBUOYDZevw9g9380u1Wek= github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4 h1:HtNGcUb52ojnl+zDAZMmbHyVaTdBjzuCnnBHpb675TU= github.com/milvus-io/milvus-proto/go-api/v2 v2.3.4/go.mod h1:1OIl0v5PQeNxIJhCvY+K55CBUOYDZevw9g9380u1Wek= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= diff --git a/test/testcases/collection_test.go b/test/testcases/collection_test.go index 2ca15a53..4c32d146 100644 --- a/test/testcases/collection_test.go +++ b/test/testcases/collection_test.go @@ -585,5 +585,5 @@ func TestGetStaticsCollectionNotExisted(t *testing.T) { // flush and check row count _, errStatist := mc.GetCollectionStatistics(ctx, "collName") - common.CheckErr(t, errStatist, false, "collection collName does not exist") + common.CheckErr(t, errStatist, false, "collection not found") } diff --git a/test/testcases/delete_test.go b/test/testcases/delete_test.go index d5094da1..14370c71 100644 --- a/test/testcases/delete_test.go +++ b/test/testcases/delete_test.go @@ -86,7 +86,7 @@ func TestDeleteNotExistCollection(t *testing.T) { // flush and check row count deleteIds := entity.NewColumnInt64(common.DefaultIntFieldName, []int64{0, 1}) errDelete := mc.DeleteByPks(ctx, "collName", common.DefaultPartition, deleteIds) - common.CheckErr(t, errDelete, false, "collection collName does not exist") + common.CheckErr(t, errDelete, false, "collection not found") } // test delete from an not exist partition @@ -105,7 +105,7 @@ func TestDeleteNotExistPartition(t *testing.T) { // delete deleteIds := entity.NewColumnInt64(common.DefaultIntFieldName, ids.(*entity.ColumnInt64).Data()[:10]) errDelete := mc.DeleteByPks(ctx, collName, "p1", deleteIds) - common.CheckErr(t, errDelete, false, fmt.Sprintf("partition p1 of collection %s does not exist", collName)) + common.CheckErr(t, errDelete, false, "partition not found") } // test delete empty partition names diff --git a/test/testcases/flush_test.go b/test/testcases/flush_test.go index 2aa37938..15ae25f9 100644 --- a/test/testcases/flush_test.go +++ b/test/testcases/flush_test.go @@ -57,7 +57,7 @@ func TestFlushNotExistedCollection(t *testing.T) { // flush and check row count errFlush := mc.Flush(ctx, "collName", false) - common.CheckErr(t, errFlush, false, "collection collName does not exist") + common.CheckErr(t, errFlush, false, "collection not found") } // test flush async diff --git a/test/testcases/index_test.go b/test/testcases/index_test.go index 4105102c..b4b69629 100644 --- a/test/testcases/index_test.go +++ b/test/testcases/index_test.go @@ -129,7 +129,7 @@ func TestCreateIndexJsonField(t *testing.T) { // create vector index on json field idx, _ := entity.NewIndexHNSW(entity.L2, 8, 96) err := mc.CreateIndex(ctx, collName, common.DefaultJSONFieldName, idx, false, client.WithIndexName("json_index")) - common.CheckErr(t, err, false, "create index on json field is not supported") + common.CheckErr(t, err, false, "create index on JSON field is not supported") // create scalar index on json field //err = mc.CreateIndex(ctx, collName, common.DefaultJSONFieldName, entity.NewScalarIndex(), false, client.WithIndexName("json_index")) @@ -163,10 +163,10 @@ func TestCreateIndexArrayField(t *testing.T) { if field.DataType == entity.FieldTypeArray { // create scalar index err := mc.CreateIndex(ctx, collName, field.Name, scalarIdx, false, client.WithIndexName("scalar_index")) - common.CheckErr(t, err, false, "create index on json field is not supported: invalid parameter") + common.CheckErr(t, err, false, "create index on Array field is not supported: invalid parameter") // create vector index err1 := mc.CreateIndex(ctx, collName, field.Name, vectorIdx, false, client.WithIndexName("vector_index")) - common.CheckErr(t, err1, false, "create index on json field is not supported: invalid parameter") + common.CheckErr(t, err1, false, "create index on Array field is not supported: invalid parameter") } } } diff --git a/test/testcases/insert_test.go b/test/testcases/insert_test.go index 30d157fa..1654d739 100644 --- a/test/testcases/insert_test.go +++ b/test/testcases/insert_test.go @@ -132,7 +132,7 @@ func TestInsertNotExistCollection(t *testing.T) { // insert intColumn, floatColumn, vecColumn := common.GenDefaultColumnData(0, common.DefaultNb, common.DefaultDim) _, errInsert := mc.Insert(ctx, "notExist", "", intColumn, floatColumn, vecColumn) - common.CheckErr(t, errInsert, false, "does not exist") + common.CheckErr(t, errInsert, false, "collection not found") } // test insert into an not existed partition @@ -148,7 +148,7 @@ func TestInsertNotExistPartition(t *testing.T) { // insert _, floatColumn, vecColumn := common.GenDefaultColumnData(0, common.DefaultNb, common.DefaultDim) _, errInsert := mc.Insert(ctx, collName, "aaa", floatColumn, vecColumn) - common.CheckErr(t, errInsert, false, "does not exist") + common.CheckErr(t, errInsert, false, "partition not found") } // test insert data into collection that has all scala fields diff --git a/test/testcases/load_release_test.go b/test/testcases/load_release_test.go index 06441a9f..9b19e4bc 100644 --- a/test/testcases/load_release_test.go +++ b/test/testcases/load_release_test.go @@ -3,7 +3,6 @@ package testcases import ( - "fmt" "log" "testing" "time" @@ -46,7 +45,7 @@ func TestLoadCollectionNotExist(t *testing.T) { // Load collection errLoad := mc.LoadCollection(ctx, "collName", false) - common.CheckErr(t, errLoad, false, "exist") + common.CheckErr(t, errLoad, false, "collection not found") } // test load collection async @@ -139,7 +138,7 @@ func TestLoadEmptyPartitionName(t *testing.T) { // load partition with empty partition names errLoadEmpty := mc.LoadPartitions(ctx, collName, []string{""}, false) - common.CheckErr(t, errLoadEmpty, false, "request failed") + common.CheckErr(t, errLoadEmpty, false, "partition not found") } // test load partitions with empty slice []string{} @@ -177,11 +176,11 @@ func TestLoadPartitionsNotExist(t *testing.T) { // load with not exist partition names errLoadNotExist := mc.LoadPartitions(ctx, collName, []string{"xxx"}, false) - common.CheckErr(t, errLoadNotExist, false, fmt.Sprintf("partition xxx of collection %s does not exist", collName)) + common.CheckErr(t, errLoadNotExist, false, "partition not found") // load partition with part exist partition names errLoadPartExist := mc.LoadPartitions(ctx, collName, []string{"xxx", partitionName}, false) - common.CheckErr(t, errLoadPartExist, false, fmt.Sprintf("partition xxx of collection %s does not exist", collName)) + common.CheckErr(t, errLoadPartExist, false, "partition not found") } // test load partition @@ -359,7 +358,7 @@ func TestReleaseCollectionNotExist(t *testing.T) { // release collection errRelease := mc.ReleaseCollection(ctx, "collName") - common.CheckErr(t, errRelease, false, "not exist") + common.CheckErr(t, errRelease, false, "collection not found") } // test release partitions diff --git a/test/testcases/upsert_test.go b/test/testcases/upsert_test.go index 9443b250..117ec08e 100644 --- a/test/testcases/upsert_test.go +++ b/test/testcases/upsert_test.go @@ -212,6 +212,7 @@ func TestUpsertMultiPartitions(t *testing.T) { // test upsert with invalid collection / partition name func TestUpsertNotExistCollectionPartition(t *testing.T) { + t.Skip("invalid paramter before partition not found") ctx := createContext(t, time.Second*common.DefaultTimeout) // connect