Skip to content

Commit

Permalink
[test]enable multi partitions in br test (#200)
Browse files Browse the repository at this point in the history
Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
  • Loading branch information
zhuwenxing authored Sep 11, 2023
1 parent d5f77dd commit f8910a6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ jobs:
./milvus-backup server > server.log 2>&1 &
- name: Run test
timeout-minutes: 60
timeout-minutes: 90
shell: bash
working-directory: tests
run: |
Expand Down
10 changes: 9 additions & 1 deletion tests/base/client_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def collection_insert_multi_segments_one_shard(self, collection_prefix, num_of_s
return collection_w

def prepare_data(self, name=None, db_name="default", nb=ct.default_nb, dim=ct.default_dim, is_binary=False, auto_id=False,
primary_field=ct.default_int64_field_name, is_flushed=True, check_function=False):
primary_field=ct.default_int64_field_name, is_flushed=True, check_function=False, enable_partition=False):
"""
prepare data for test case
"""
Expand All @@ -262,6 +262,9 @@ def prepare_data(self, name=None, db_name="default", nb=ct.default_nb, dim=ct.de
default_schema = cf.gen_default_binary_collection_schema(auto_id=auto_id, dim=dim,
primary_field=primary_field)
collection_w = self.init_collection_wrap(name=name, schema=default_schema, active_trace=True)
# create partitions
if enable_partition:
partition_w = self.init_partition_wrap(collection_wrap=collection_w)
assert collection_w.name == name
if nb > 0:
cf.insert_data(collection_w, nb=nb, is_binary=is_binary, auto_id=auto_id, dim=dim)
Expand Down Expand Up @@ -343,6 +346,11 @@ def compare_collections(self, src_name, dist_name, output_fields=None):
f"collection_src num_entities: {collection_src.num_entities} != " \
f"collection_dist num_entities: {collection_dist.num_entities}"
assert collection_src.schema == collection_dist.schema
# get partitions
partitions_src = collection_src.partitions
partitions_dist = collection_dist.partitions
log.info(f"partitions_src: {partitions_src}, partitions_dist: {partitions_dist}")
assert len(partitions_src) == len(partitions_dist)

for coll in [collection_src, collection_dist]:
is_binary = self.is_binary_by_schema(coll.schema)
Expand Down
11 changes: 6 additions & 5 deletions tests/testcases/test_restore_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,28 @@ class TestRestoreBackup(TestcaseBase):
""" Test case of end to end"""

@pytest.mark.tags(CaseLabel.L1)
@pytest.mark.parametrize("nb", [0, 3000])
@pytest.mark.parametrize("nb", [3000])
@pytest.mark.parametrize("is_auto_id", [True, False])
@pytest.mark.parametrize("enable_partition", [True, False])
@pytest.mark.parametrize("is_async", [True, False])
@pytest.mark.parametrize("collection_need_to_restore", [1, 2, 3])
@pytest.mark.parametrize("collection_type", ["binary", "float", "all"])
def test_milvus_restore_back(self, collection_type, collection_need_to_restore, is_async, is_auto_id, nb):
def test_milvus_restore_back(self, collection_type, collection_need_to_restore, is_async, is_auto_id, enable_partition, nb):
# prepare data
names_origin = []
back_up_name = cf.gen_unique_str(backup_prefix)
if collection_type == "all":
for is_binary in [True, False, False]:
names_origin.append(cf.gen_unique_str(prefix))
self.prepare_data(names_origin[-1], nb=nb, is_binary=is_binary, auto_id=is_auto_id, check_function=False)
self.prepare_data(names_origin[-1], nb=nb, is_binary=is_binary, auto_id=is_auto_id, check_function=False, enable_partition=enable_partition)
if collection_type == "float":
for is_binary in [False, False, False]:
names_origin.append(cf.gen_unique_str(prefix))
self.prepare_data(names_origin[-1], nb=nb, is_binary=is_binary, auto_id=is_auto_id, check_function=False)
self.prepare_data(names_origin[-1], nb=nb, is_binary=is_binary, auto_id=is_auto_id, check_function=False, enable_partition=enable_partition)
if collection_type == "binary":
for is_binary in [True, True, True]:
names_origin.append(cf.gen_unique_str(prefix))
self.prepare_data(names_origin[-1], nb=nb, is_binary=is_binary, auto_id=is_auto_id, check_function=False)
self.prepare_data(names_origin[-1], nb=nb, is_binary=is_binary, auto_id=is_auto_id, check_function=False, enable_partition=enable_partition)
log.info(f"name_origin:{names_origin}, back_up_name: {back_up_name}")
for name in names_origin:
res, _ = self.utility_wrap.has_collection(name)
Expand Down

0 comments on commit f8910a6

Please sign in to comment.