Files
qdrant/openapi/tests/openapi_integration/test_service.py
Tim Visée 1e4ce145a2 Parameterize integration tests (#2375)
* Clean up imports

* Clean up whitespace

* Use drop collection function from helpers

* Use parameterized integration tests to test on_disk variations

* Promote on_disk_vectors parameter into dedicated fixture

* Merge basic retrieve test with parameterization

* Flatten functions

* Split validation test functions

* Don't parameterize on_disk states when testing validation

* Parameterize init_from_collection test sequence

* Parameterize on_disk_payload in tests with fixture

* Parameterize new batch update tests

* Fix integration test collection setup distance after incorrect merge
2023-08-09 12:32:27 +02:00

51 lines
1.5 KiB
Python

import pytest
from datetime import datetime, timedelta
from .helpers.collection_setup import basic_collection_setup, drop_collection
from .helpers.fixtures import on_disk_vectors
from .helpers.helpers import request_with_validation
collection_name = 'test_collection_telemetry'
@pytest.fixture(autouse=True, scope="module")
def setup(on_disk_vectors):
basic_collection_setup(collection_name=collection_name, on_disk_vectors=on_disk_vectors)
yield
drop_collection(collection_name=collection_name)
def test_metrics():
response = request_with_validation(
api='/metrics',
method="GET",
)
assert response.ok
# Probe some strings that must exist in the metrics output
assert '# HELP app_info information about qdrant server' in response.text
assert '# TYPE app_info counter' in response.text
assert 'app_info{name="qdrant",version="' in response.text
assert 'collections_total ' in response.text
def test_telemetry():
response = request_with_validation(
api='/telemetry',
method="GET",
)
assert response.ok
result = response.json()['result']
assert result['collections']['number_of_collections'] >= 1
endpoint = result['requests']['rest']['responses']['PUT /collections/{name}/points']
assert endpoint['200']['count'] > 0
last_queried = endpoint['200']['last_responded']
last_queried = datetime.fromisoformat(last_queried)
# Assert today
assert last_queried.date() == datetime.now().date()