mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-04 04:49:08 +08:00
Describe collection by collection ID (#9471)
Signed-off-by: dragondriver <jiquan.long@zilliz.com>
This commit is contained in:
parent
28a90f9e7a
commit
302ca04d6c
@ -2636,10 +2636,11 @@ func (dct *describeCollectionTask) PreExecute(ctx context.Context) error {
|
|||||||
dct.Base.MsgType = commonpb.MsgType_DescribeCollection
|
dct.Base.MsgType = commonpb.MsgType_DescribeCollection
|
||||||
dct.Base.SourceID = Params.ProxyID
|
dct.Base.SourceID = Params.ProxyID
|
||||||
|
|
||||||
if err := ValidateCollectionName(dct.CollectionName); err != nil {
|
if dct.CollectionID != 0 && len(dct.CollectionName) == 0 {
|
||||||
return err
|
return nil
|
||||||
}
|
}
|
||||||
return nil
|
|
||||||
|
return ValidateCollectionName(dct.CollectionName)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dct *describeCollectionTask) Execute(ctx context.Context) error {
|
func (dct *describeCollectionTask) Execute(ctx context.Context) error {
|
||||||
|
@ -1311,7 +1311,14 @@ func TestDescribeCollectionTask(t *testing.T) {
|
|||||||
err = task.PreExecute(ctx)
|
err = task.PreExecute(ctx)
|
||||||
assert.NotNil(t, err)
|
assert.NotNil(t, err)
|
||||||
|
|
||||||
|
// describe collection with id
|
||||||
|
task.CollectionID = 1
|
||||||
|
task.CollectionName = ""
|
||||||
|
err = task.PreExecute(ctx)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
rc.Stop()
|
rc.Stop()
|
||||||
|
task.CollectionID = 0
|
||||||
task.CollectionName = collectionName
|
task.CollectionName = collectionName
|
||||||
err = task.PreExecute(ctx)
|
err = task.PreExecute(ctx)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
|
Loading…
Reference in New Issue
Block a user