test: add dynamicfield.enabled property alter in chaos checker (#45625)

/kind improvement

Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
This commit is contained in:
zhuwenxing 2025-11-27 14:53:08 +08:00 committed by GitHub
parent f455910bee
commit 464a805c63
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 7 deletions

View File

@ -389,7 +389,8 @@ class Checker:
schema = CollectionSchema.construct_from_dict(collection_info)
else:
enable_struct_array_field = kwargs.get("enable_struct_array_field", True)
schema = cf.gen_all_datatype_collection_schema(dim=dim, enable_struct_array_field=enable_struct_array_field) if schema is None else schema
enable_dynamic_field = kwargs.get("enable_dynamic_field", True)
schema = cf.gen_all_datatype_collection_schema(dim=dim, enable_struct_array_field=enable_struct_array_field, enable_dynamic_field=enable_dynamic_field) if schema is None else schema
log.info(f"schema: {schema}")
self.schema = schema
@ -2335,17 +2336,19 @@ class AlterCollectionChecker(Checker):
def __init__(self, collection_name=None, schema=None):
if collection_name is None:
collection_name = cf.gen_unique_str("AlterCollectionChecker")
super().__init__(collection_name=collection_name, schema=schema)
super().__init__(collection_name=collection_name, schema=schema, enable_dynamic_field=False)
self.milvus_client.release_collection(collection_name=self.c_name)
res = self.milvus_client.describe_collection(collection_name=self.c_name)
log.info(f"before alter collection {self.c_name} properties: {res}")
log.info(f"before alter collection {self.c_name} schema: {res}")
# alter collection attributes
self.milvus_client.alter_collection_properties(collection_name=self.c_name,
properties={"mmap.enabled": True})
self.milvus_client.alter_collection_properties(collection_name=self.c_name,
properties={"collection.ttl.seconds": 3600})
self.milvus_client.alter_collection_properties(collection_name=self.c_name,
properties={"dynamicfield.enabled": True})
res = self.milvus_client.describe_collection(collection_name=self.c_name)
log.info(f"after alter collection {self.c_name} properties: {res}")
log.info(f"after alter collection {self.c_name} schema: {res}")
@trace()
def alter_check(self):
@ -2356,6 +2359,8 @@ class AlterCollectionChecker(Checker):
return res, False
if properties.get("collection.ttl.seconds") != "3600":
return res, False
if res["enable_dynamic_field"] != True:
return res, False
return res, True
except Exception as e:
return str(e), False

View File

@ -1,7 +1,7 @@
[pytest]
addopts = --host localhost --html=/tmp/ci_logs/report.html --self-contained-html -v --log-cli-level INFO
addopts = --host localhost --html=/tmp/ci_logs/report.html --self-contained-html -v
# python3 -W ignore -m pytest
log_format = [%(asctime)s - %(levelname)s - %(name)s]: %(message)s (%(filename)s:%(lineno)s)