Skip to content

Commit 50ac673

Browse files
committed
test(metrics): add integration tests for metrics retrieval
- Create `metrics_test.py` to test the `Metrics` class - Implement test for the `retrieve()` method - Verify all expected system metrics fields are p
1 parent cc039f3 commit 50ac673

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/metrics_test.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"""Tests for the Debug class."""
2+
3+
from __future__ import annotations
4+
5+
from typesense.metrics import Metrics
6+
7+
8+
def test_actual_retrieve(actual_metrics: Metrics) -> None:
9+
"""Test that the Debug object can retrieve a debug on Typesense server and verify response structure."""
10+
response = actual_metrics.retrieve()
11+
12+
assert "system_cpu_active_percentage" in response
13+
assert "system_disk_total_bytes" in response
14+
assert "system_disk_used_bytes" in response
15+
assert "system_memory_total_bytes" in response
16+
assert "system_memory_used_bytes" in response
17+
assert "system_network_received_bytes" in response
18+
assert "system_network_sent_bytes" in response
19+
assert "typesense_memory_active_bytes" in response
20+
assert "typesense_memory_allocated_bytes" in response
21+
assert "typesense_memory_fragmentation_ratio" in response
22+
23+
assert "typesense_memory_mapped_bytes" in response
24+
assert "typesense_memory_metadata_bytes" in response
25+
assert "typesense_memory_resident_bytes" in response
26+
assert "typesense_memory_retained_bytes" in response

0 commit comments

Comments
 (0)