Skip to content

Commit

Permalink
test: fix nightly failed case
Browse files Browse the repository at this point in the history
Signed-off-by: ThreadDao <[email protected]>
  • Loading branch information
ThreadDao committed Dec 9, 2024
1 parent c00ec06 commit 9cebd56
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 23 deletions.
4 changes: 2 additions & 2 deletions test/common/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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] >
Expand Down
24 changes: 9 additions & 15 deletions test/testcases/index_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
}
}
}
Expand Down
10 changes: 4 additions & 6 deletions test/testcases/load_release_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
}
}

Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 9cebd56

Please sign in to comment.