|
@@ 174-202 (lines=29) @@
|
| 171 |
|
assert res == 0 |
| 172 |
|
|
| 173 |
|
# TODO: enable |
| 174 |
|
@pytest.mark.level(2) |
| 175 |
|
@pytest.mark.timeout(20) |
| 176 |
|
def _test_collection_rows_count_multiprocessing(self, connect, collection, args): |
| 177 |
|
''' |
| 178 |
|
target: test collection rows_count is correct or not with multiprocess |
| 179 |
|
method: create collection and add vectors in it, |
| 180 |
|
assert the value returned by count_entities method is equal to length of vectors |
| 181 |
|
expected: the count is equal to the length of vectors |
| 182 |
|
''' |
| 183 |
|
nq = 2 |
| 184 |
|
vectors = gen_vectors(nq, dim) |
| 185 |
|
res = connect.insert(collection_name=collection, records=vectors) |
| 186 |
|
time.sleep(add_time_interval) |
| 187 |
|
|
| 188 |
|
def rows_count(milvus): |
| 189 |
|
status, res = milvus.count_entities(collection) |
| 190 |
|
logging.getLogger().info(status) |
| 191 |
|
assert res == nq |
| 192 |
|
|
| 193 |
|
process_num = 8 |
| 194 |
|
processes = [] |
| 195 |
|
for i in range(process_num): |
| 196 |
|
milvus = get_milvus(args["ip"], args["port"], handler=args["handler"]) |
| 197 |
|
p = Process(target=rows_count, args=(milvus, )) |
| 198 |
|
processes.append(p) |
| 199 |
|
p.start() |
| 200 |
|
logging.getLogger().info(p) |
| 201 |
|
for p in processes: |
| 202 |
|
p.join() |
| 203 |
|
|
| 204 |
|
def test_collection_rows_count_multi_collections(self, connect): |
| 205 |
|
''' |
|
@@ 318-345 (lines=28) @@
|
| 315 |
|
assert res == 0 |
| 316 |
|
|
| 317 |
|
# TODO: enable |
| 318 |
|
@pytest.mark.timeout(60) |
| 319 |
|
def _test_collection_rows_count_multiprocessing(self, connect, ip_collection, args): |
| 320 |
|
''' |
| 321 |
|
target: test collection rows_count is correct or not with multiprocess |
| 322 |
|
method: create collection and add vectors in it, |
| 323 |
|
assert the value returned by count_entities method is equal to length of vectors |
| 324 |
|
expected: the count is equal to the length of vectors |
| 325 |
|
''' |
| 326 |
|
nq = 2 |
| 327 |
|
vectors = gen_vectors(nq, dim) |
| 328 |
|
res = connect.insert(collection_name=ip_collection, records=vectors) |
| 329 |
|
time.sleep(add_time_interval) |
| 330 |
|
|
| 331 |
|
def rows_count(milvus): |
| 332 |
|
status, res = milvus.count_entities(ip_collection) |
| 333 |
|
logging.getLogger().info(status) |
| 334 |
|
assert res == nq |
| 335 |
|
|
| 336 |
|
process_num = 8 |
| 337 |
|
processes = [] |
| 338 |
|
for i in range(process_num): |
| 339 |
|
milvus = get_milvus(args["ip"], args["port"], handler=args["handler"]) |
| 340 |
|
p = Process(target=rows_count, args=(milvus,)) |
| 341 |
|
processes.append(p) |
| 342 |
|
p.start() |
| 343 |
|
logging.getLogger().info(p) |
| 344 |
|
for p in processes: |
| 345 |
|
p.join() |
| 346 |
|
|
| 347 |
|
def test_collection_rows_count_multi_collections(self, connect): |
| 348 |
|
''' |