Files
qdrant/openapi/tests/openapi_integration/test_count.py
Luis Cossío e70a80add7 CI: make integration tests 45% faster (#1902)
* use scope="module" where possible

* refactor test_snapshot.py to use loop and timeout instead of long waits
2023-05-16 15:23:03 +02:00

72 lines
2.0 KiB
Python

import pytest
from .helpers.collection_setup import basic_collection_setup, drop_collection
from .helpers.helpers import request_with_validation
collection_name = 'test_collection_threshold'
@pytest.fixture(autouse=True, scope="module")
def setup():
basic_collection_setup(collection_name=collection_name)
yield
drop_collection(collection_name=collection_name)
def test_exact_count_search():
response = request_with_validation(
api='/collections/{collection_name}/points/count',
method="POST",
path_params={'collection_name': collection_name},
body={
"filter": {
"should": [
{
"key": "city",
"match": {
"value": "London"
}
},
{
"key": "city",
"match": {
"value": "Berlin"
}
}
]
}
}
)
assert response.ok
assert response.json()['result']['count'] == 4
def test_approx_count_search():
response = request_with_validation(
api='/collections/{collection_name}/points/count',
method="POST",
path_params={'collection_name': collection_name},
body={
"filter": {
"should": [
{
"key": "city",
"match": {
"value": "London"
}
},
{
"key": "city",
"match": {
"value": "Berlin"
}
}
]
},
"exact": False
}
)
assert response.ok
assert response.json()['result']['count'] < 8
assert response.json()['result']['count'] > 0