mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-04 21:09:06 +08:00
762b1e1f1f
Signed-off-by: bigsheeper <yihao.dai@zilliz.com>
49 lines
1.4 KiB
Go
49 lines
1.4 KiB
Go
package querynode
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/golang/protobuf/proto"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestCollection_Partitions(t *testing.T) {
|
|
node := newQueryNode()
|
|
collectionName := "collection0"
|
|
collectionID := UniqueID(0)
|
|
initTestMeta(t, node, collectionName, collectionID, 0)
|
|
|
|
collection, err := node.replica.getCollectionByName(collectionName)
|
|
assert.NoError(t, err)
|
|
|
|
partitions := collection.Partitions()
|
|
assert.Equal(t, 1, len(*partitions))
|
|
}
|
|
|
|
func TestCollection_newCollection(t *testing.T) {
|
|
collectionName := "collection0"
|
|
collectionID := UniqueID(0)
|
|
collectionMeta := genTestCollectionMeta(collectionName, collectionID)
|
|
|
|
schemaBlob := proto.MarshalTextString(collectionMeta.Schema)
|
|
assert.NotEqual(t, "", schemaBlob)
|
|
|
|
collection := newCollection(collectionMeta.ID, schemaBlob)
|
|
assert.Equal(t, collection.Name(), collectionName)
|
|
assert.Equal(t, collection.ID(), collectionID)
|
|
}
|
|
|
|
func TestCollection_deleteCollection(t *testing.T) {
|
|
collectionName := "collection0"
|
|
collectionID := UniqueID(0)
|
|
collectionMeta := genTestCollectionMeta(collectionName, collectionID)
|
|
|
|
schemaBlob := proto.MarshalTextString(collectionMeta.Schema)
|
|
assert.NotEqual(t, "", schemaBlob)
|
|
|
|
collection := newCollection(collectionMeta.ID, schemaBlob)
|
|
assert.Equal(t, collection.Name(), collectionName)
|
|
assert.Equal(t, collection.ID(), collectionID)
|
|
deleteCollection(collection)
|
|
}
|