From 9cebd56cf804125cf621910fb9202957f3defaea Mon Sep 17 00:00:00 2001 From: ThreadDao Date: Mon, 9 Dec 2024 15:27:17 +0800 Subject: [PATCH] test: fix nightly failed case Signed-off-by: ThreadDao --- test/common/utils.go | 4 ++-- test/testcases/index_test.go | 24 +++++++++--------------- test/testcases/load_release_test.go | 10 ++++------ 3 files changed, 15 insertions(+), 23 deletions(-) diff --git a/test/common/utils.go b/test/common/utils.go index 7a6d268e..9e287295 100644 --- a/test/common/utils.go +++ b/test/common/utils.go @@ -1415,8 +1415,8 @@ var InvalidExpressions = []InvalidExprStruct{ {Expr: fmt.Sprintf("%s[0] == [2, 3]", DefaultJSONFieldName), ErrNil: true, ErrMsg: ""}, // field exist but type not match {Expr: fmt.Sprintf("json_contains (%s['number'], 2)", DefaultJSONFieldName), ErrNil: true, ErrMsg: ""}, {Expr: fmt.Sprintf("json_contains (%s['list'], [2])", DefaultJSONFieldName), ErrNil: true, ErrMsg: ""}, - {Expr: fmt.Sprintf("json_contains_all (%s['list'], 2)", DefaultJSONFieldName), ErrNil: false, ErrMsg: "contains_all operation element must be an array"}, - {Expr: fmt.Sprintf("JSON_CONTAINS_ANY (%s['list'], 2)", DefaultJSONFieldName), ErrNil: false, ErrMsg: "contains_any operation element must be an array"}, + {Expr: fmt.Sprintf("json_contains_all (%s['list'], 2)", DefaultJSONFieldName), ErrNil: false, ErrMsg: "ContainsAll operation element must be an array"}, + {Expr: fmt.Sprintf("JSON_CONTAINS_ANY (%s['list'], 2)", DefaultJSONFieldName), ErrNil: false, ErrMsg: "ContainsAny operation element must be an array"}, {Expr: fmt.Sprintf("json_contains_aby (%s['list'], 2)", DefaultJSONFieldName), ErrNil: false, ErrMsg: "invalid expression: json_contains_aby"}, {Expr: fmt.Sprintf("json_contains_aby (%s['list'], 2)", DefaultJSONFieldName), ErrNil: false, ErrMsg: "invalid expression: json_contains_aby"}, {Expr: fmt.Sprintf("%s[-1] > %d", DefaultInt8ArrayField, TestCapacity), ErrNil: false, ErrMsg: "cannot parse expression"}, // array[-1] > diff --git a/test/testcases/index_test.go b/test/testcases/index_test.go index 7d2f007b..fe267e56 100644 --- a/test/testcases/index_test.go +++ b/test/testcases/index_test.go @@ -426,7 +426,6 @@ func TestCreateInvertedScalarIndex(t *testing.T) { // create Bitmap index for all scalar fields func TestCreateBitmapScalarIndex(t *testing.T) { - t.Skip("waiting for bitmap pr cherry-pick") ctx := createContext(t, time.Second*common.DefaultTimeout*2) // connect mc := createMilvusClient(ctx, t) @@ -460,20 +459,15 @@ func TestCreateBitmapScalarIndex(t *testing.T) { err := mc.CreateIndex(ctx, collName, field.Name, idx, false, client.WithIndexName(field.Name)) common.CheckErr(t, err, false, "bitmap index are only supported") } else { - if field.PrimaryKey { - err := mc.CreateIndex(ctx, collName, field.Name, idx, false, client.WithIndexName(field.Name)) - common.CheckErr(t, err, false, "create bitmap index on primary key not supported") - } else { - err := mc.CreateIndex(ctx, collName, field.Name, idx, false, client.WithIndexName(field.Name)) - common.CheckErr(t, err, true) - - // describe index - indexes, _ := mc.DescribeIndex(ctx, collName, field.Name) - require.Len(t, indexes, 1) - log.Println(indexes[0].Name(), indexes[0].IndexType(), indexes[0].Params()) - expIndex := entity.NewGenericIndex(field.Name, entity.Bitmap, idx.Params()) - common.CheckIndexResult(t, indexes, expIndex) - } + err := mc.CreateIndex(ctx, collName, field.Name, idx, false, client.WithIndexName(field.Name)) + common.CheckErr(t, err, true) + + // describe index + indexes, _ := mc.DescribeIndex(ctx, collName, field.Name) + require.Len(t, indexes, 1) + log.Println(indexes[0].Name(), indexes[0].IndexType(), indexes[0].Params()) + expIndex := entity.NewGenericIndex(field.Name, entity.Bitmap, idx.Params()) + common.CheckIndexResult(t, indexes, expIndex) } } } diff --git a/test/testcases/load_release_test.go b/test/testcases/load_release_test.go index f40bf0ba..f6f8af6a 100644 --- a/test/testcases/load_release_test.go +++ b/test/testcases/load_release_test.go @@ -816,7 +816,6 @@ func TestMmapScalarInvertedIndex(t *testing.T) { // test mmap scalar index: bitmap func TestMmapScalarBitmapIndex(t *testing.T) { - t.Skip("waiting for bitmap pr cherry-pick") // vector index ctx := createContext(t, time.Second*common.DefaultTimeout*2) // connect @@ -844,8 +843,9 @@ func TestMmapScalarBitmapIndex(t *testing.T) { BitmapNotSupport := []interface{}{entity.FieldTypeJSON, entity.FieldTypeDouble, entity.FieldTypeFloat} for _, field := range collection.Schema.Fields { if SupportScalarIndexFieldType(field.DataType) && !field.PrimaryKey && !(common.CheckContainsValue(BitmapNotSupport, field.DataType) || (field.DataType == entity.FieldTypeArray && common.CheckContainsValue(BitmapNotSupport, field.ElementType))) { + log.Println(field.Name, field.DataType) err := mc.CreateIndex(ctx, collName, field.Name, entity.NewScalarIndexWithType(entity.Bitmap), false, client.WithMmap(true)) - common.CheckErr(t, err, true) + common.CheckErr(t, err, false, "index type BITMAP does not support mmap") } } @@ -961,7 +961,6 @@ func TestMmapIndexUnsupported(t *testing.T) { // test mmap unsupported index: DiskANN, GPU-class func TestMmapScalarAutoIndex(t *testing.T) { - t.Skip("waiting for bitmap pr cherry-pick") ctx := createContext(t, time.Second*common.DefaultTimeout*2) // connect mc := createMilvusClient(ctx, t) @@ -986,11 +985,10 @@ func TestMmapScalarAutoIndex(t *testing.T) { // mmap not supported HYBRID index err1 = mc.CreateIndex(ctx, collName, common.DefaultBoolFieldName, entity.NewScalarIndexWithType(entity.Bitmap), false, client.WithMmap(true)) - common.CheckErr(t, err1, true) + common.CheckErr(t, err1, false, "index type BITMAP does not support mmap") } func TestAlterIndexMmapUnsupportedIndex(t *testing.T) { - t.Skip("waiting for bitmap pr cherry-pick") ctx := createContext(t, time.Second*common.DefaultTimeout*2) // connect mc := createMilvusClient(ctx, t) @@ -1011,7 +1009,7 @@ func TestAlterIndexMmapUnsupportedIndex(t *testing.T) { // bitmap index with mmap, create bitmap index on primary key not supported err = mc.CreateIndex(ctx, collName, common.DefaultIntFieldName, entity.NewScalarIndexWithType(entity.Bitmap), false) - common.CheckErr(t, err, false, "create bitmap index on primary key not supported") + common.CheckErr(t, err, true) // HYBRID index err = mc.CreateIndex(ctx, collName, common.DefaultInt32FieldName, entity.NewScalarIndex(), false)