test: skip index if it already created (#32402)

Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
pull/32468/head
zhuwenxing 2024-04-22 10:37:22 +08:00 committed by GitHub
parent 5fc439c600
commit 8442098457
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 0 deletions

View File

@ -357,8 +357,13 @@ class Checker:
self.scalar_field_names = cf.get_scalar_field_name_list(schema=schema)
self.float_vector_field_names = cf.get_float_vec_field_name_list(schema=schema)
self.binary_vector_field_names = cf.get_binary_vec_field_name_list(schema=schema)
# get index of collection
indexes = [index.to_dict() for index in self.c_wrap.indexes]
indexed_fields = [index['field'] for index in indexes]
# create index for scalar fields
for f in self.scalar_field_names:
if f in indexed_fields:
continue
self.c_wrap.create_index(f,
{"index_type": "INVERTED"},
timeout=timeout,
@ -366,6 +371,8 @@ class Checker:
check_task=CheckTasks.check_nothing)
# create index for float vector fields
for f in self.float_vector_field_names:
if f in indexed_fields:
continue
self.c_wrap.create_index(f,
constants.DEFAULT_INDEX_PARAM,
timeout=timeout,
@ -373,6 +380,8 @@ class Checker:
check_task=CheckTasks.check_nothing)
# create index for binary vector fields
for f in self.binary_vector_field_names:
if f in indexed_fields:
continue
self.c_wrap.create_index(f,
constants.DEFAULT_BINARY_INDEX_PARAM,
timeout=timeout,