mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
test: test mix scenes support batch insertion (#40871)
issues: https://github.com/milvus-io/milvus/issues/40868 Signed-off-by: wangting0128 <ting.wang@zilliz.com>
This commit is contained in:
parent
9b7d66d9da
commit
34131d93ae
@ -3327,3 +3327,13 @@ def gen_unicode_string_batch(nb, string_len: int = 1):
|
||||
def gen_unicode_string_array_batch(nb, string_len: int = 1, max_capacity: int = ct.default_max_capacity):
|
||||
return [[''.join([gen_unicode_string() for _ in range(min(random.randint(1, string_len), 50))]) for _ in
|
||||
range(random.randint(0, max_capacity))] for _ in range(nb)]
|
||||
|
||||
|
||||
def iter_insert_list_data(data: list, batch: int, total_len: int):
|
||||
nb_list = [batch for _ in range(int(total_len / batch))]
|
||||
if total_len % batch > 0:
|
||||
nb_list.append(total_len % batch)
|
||||
|
||||
data_obj = [iter(d) for d in data]
|
||||
for n in nb_list:
|
||||
yield [[next(o) for _ in range(n)] for o in data_obj]
|
||||
|
||||
@ -56,7 +56,8 @@ class TestNoIndexDQLExpr(TestCaseClassBase):
|
||||
|
||||
@pytest.fixture(scope="class", autouse=True)
|
||||
def prepare_data(self):
|
||||
self.collection_wrap.insert(data=list(self.insert_data.values()), check_task=CheckTasks.check_insert_result)
|
||||
for d in cf.iter_insert_list_data(list(self.insert_data.values()), batch=3000, total_len=self.nb):
|
||||
self.collection_wrap.insert(data=d, check_task=CheckTasks.check_insert_result)
|
||||
|
||||
# flush collection, segment sealed
|
||||
self.collection_wrap.flush()
|
||||
@ -270,7 +271,8 @@ class TestHybridIndexDQLExpr(TestCaseClassBase):
|
||||
|
||||
@pytest.fixture(scope="class", autouse=True)
|
||||
def prepare_data(self):
|
||||
self.collection_wrap.insert(data=list(self.insert_data.values()), check_task=CheckTasks.check_insert_result)
|
||||
for d in cf.iter_insert_list_data(list(self.insert_data.values()), batch=3000, total_len=self.nb):
|
||||
self.collection_wrap.insert(data=d, check_task=CheckTasks.check_insert_result)
|
||||
|
||||
# flush collection, segment sealed
|
||||
self.collection_wrap.flush()
|
||||
@ -572,7 +574,8 @@ class TestInvertedIndexDQLExpr(TestCaseClassBase):
|
||||
|
||||
@pytest.fixture(scope="class", autouse=True)
|
||||
def prepare_data(self):
|
||||
self.collection_wrap.insert(data=list(self.insert_data.values()), check_task=CheckTasks.check_insert_result)
|
||||
for d in cf.iter_insert_list_data(list(self.insert_data.values()), batch=3000, total_len=self.nb):
|
||||
self.collection_wrap.insert(data=d, check_task=CheckTasks.check_insert_result)
|
||||
|
||||
# flush collection, segment sealed
|
||||
self.collection_wrap.flush()
|
||||
@ -839,7 +842,8 @@ class TestBitmapIndexDQLExpr(TestCaseClassBase):
|
||||
|
||||
@pytest.fixture(scope="class", autouse=True)
|
||||
def prepare_data(self):
|
||||
self.collection_wrap.insert(data=list(self.insert_data.values()), check_task=CheckTasks.check_insert_result)
|
||||
for d in cf.iter_insert_list_data(list(self.insert_data.values()), batch=3000, total_len=self.nb):
|
||||
self.collection_wrap.insert(data=d, check_task=CheckTasks.check_insert_result)
|
||||
|
||||
# flush collection, segment sealed
|
||||
self.collection_wrap.flush()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user