提交 2031c547 编写于 作者: C cai.zhang 提交者: yefu.chen

Add unittest about index in proxy

Signed-off-by: Ncai.zhang <cai.zhang@zilliz.com>
上级 a56f8f7b
......@@ -189,10 +189,6 @@ func createIndex(t *testing.T, collectionName, fieldName string) {
CollectionName: collectionName,
FieldName: fieldName,
ExtraParams: []*commonpb.KeyValuePair{
{
Key: "nlist",
Value: "1024",
},
{
Key: "metric_type",
Value: "L2",
......@@ -478,21 +474,86 @@ func TestProxy_PartitionGRPC(t *testing.T) {
dropCollection(t, collName)
}
// func TestProxy_CreateIndex(t *testing.T) {
// var wg sync.WaitGroup
// for i := 0; i < testNum; i++ {
// i := i
// collectionName := "Collection" + strconv.FormatInt(int64(i), 10)
// fieldName := "Field" + strconv.FormatInt(int64(i), 10)
// wg.Add(1)
// go func(group *sync.WaitGroup) {
// defer group.Done()
// createIndex(t, collectionName, fieldName)
// // dropIndex(t, collectionName, fieldName, indexName)
// }(&wg)
// }
// wg.Wait()
// }
func TestProxy_CreateIndex(t *testing.T) {
var wg sync.WaitGroup
for i := 0; i < testNum; i++ {
i := i
collName := "collName" + strconv.FormatInt(int64(i), 10)
fieldName := "Field1"
if i%2 == 0 {
fieldName = "vec"
}
wg.Add(1)
go func(group *sync.WaitGroup) {
defer group.Done()
createCollection(t, collName)
createIndex(t, collName, fieldName)
dropCollection(t, collName)
// dropIndex(t, collectionName, fieldName, indexName)
}(&wg)
}
wg.Wait()
}
func TestProxy_DescribeIndex(t *testing.T) {
var wg sync.WaitGroup
for i := 0; i < testNum; i++ {
i := i
collName := "collName" + strconv.FormatInt(int64(i), 10)
fieldName := "Field1"
if i%2 == 0 {
fieldName = "vec"
}
wg.Add(1)
go func(group *sync.WaitGroup) {
defer group.Done()
createCollection(t, collName)
createIndex(t, collName, fieldName)
req := &servicepb.DescribeIndexRequest{
CollectionName: collName,
FieldName: fieldName,
}
resp, err := proxyClient.DescribeIndex(ctx, req)
assert.Nil(t, err)
msg := "Describe Index for " + fieldName + "should successed!"
assert.Equal(t, resp.Status.ErrorCode, commonpb.ErrorCode_SUCCESS, msg)
dropCollection(t, collName)
}(&wg)
}
wg.Wait()
}
func TestProxy_DescribeIndexProgress(t *testing.T) {
var wg sync.WaitGroup
for i := 0; i < testNum; i++ {
i := i
collName := "collName" + strconv.FormatInt(int64(i), 10)
fieldName := "Field1"
if i%2 == 0 {
fieldName = "vec"
}
wg.Add(1)
go func(group *sync.WaitGroup) {
defer group.Done()
createCollection(t, collName)
createIndex(t, collName, fieldName)
req := &servicepb.DescribeIndexProgressRequest{
CollectionName: collName,
FieldName: fieldName,
}
resp, err := proxyClient.DescribeIndexProgress(ctx, req)
assert.Nil(t, err)
msg := "Describe Index Progress for " + fieldName + "should succeed!"
assert.Equal(t, resp.Status.ErrorCode, commonpb.ErrorCode_SUCCESS, msg)
assert.True(t, resp.Value)
dropCollection(t, collName)
}(&wg)
}
wg.Wait()
}
func TestMain(m *testing.M) {
setup()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册