milvus/internal/util/segcore/collection_test.go
Zhen Ye c6dcef7b84
enhance: move segcore codes of segment into one package (#37722)
issue: #33285

- move most cgo opeartions related to search/query into segcore package
for reusing for streamingnode.
- add go unittest for segcore operations.

Signed-off-by: chyezh <chyezh@outlook.com>
2024-11-29 10:22:36 +08:00

30 lines
877 B
Go

package segcore_test
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/milvus-io/milvus-proto/go-api/v2/schemapb"
"github.com/milvus-io/milvus/internal/mocks/util/mock_segcore"
"github.com/milvus-io/milvus/internal/util/segcore"
"github.com/milvus-io/milvus/pkg/util/paramtable"
)
func TestCollection(t *testing.T) {
paramtable.Init()
schema := mock_segcore.GenTestCollectionSchema("test", schemapb.DataType_Int64, false)
indexMeta := mock_segcore.GenTestIndexMeta(1, schema)
ccollection, err := segcore.CreateCCollection(&segcore.CreateCCollectionRequest{
CollectionID: 1,
Schema: schema,
IndexMeta: indexMeta,
})
assert.NoError(t, err)
assert.NotNil(t, ccollection)
assert.NotNil(t, ccollection.Schema())
assert.NotNil(t, ccollection.IndexMeta())
assert.Equal(t, int64(1), ccollection.ID())
defer ccollection.Release()
}