test: [cherry-pick]add testcase for count query (#34471)

pr: https://github.com/milvus-io/milvus/pull/34453

Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
pull/34479/head
zhuwenxing 2024-07-08 12:54:12 +08:00 committed by GitHub
parent a60e2a65ff
commit f2d0517f96
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 20 additions and 0 deletions

View File

@ -2124,6 +2124,26 @@ class TestQueryVector(TestBase):
assert rsp['code'] == 0
assert rsp['data'][0]['count(*)'] == 3000
@pytest.mark.parametrize("filter_expr", ["", None])
def test_query_vector_with_count_simple(self, filter_expr):
"""
Query a vector with a simple payload
"""
name = gen_collection_name()
self.name = name
self.init_collection(name, nb=3000)
# query for "count(*)"
payload = {
"collectionName": name,
"filter": filter_expr,
"outputFields": ["count(*)"]
}
if filter_expr is None:
payload.pop("filter")
rsp = self.vector_client.vector_query(payload)
assert rsp['code'] == 0
assert rsp['data'][0]['count(*)'] == 3000
@pytest.mark.xfail(reason="query by id is not supported")
def test_query_vector_by_id(self):
"""