Skip to content

Commit 24cb4ac

Browse files
committed
linux only metrics
Signed-off-by: phanirithvij <phanirithvij2000@gmail.com>
1 parent e863b44 commit 24cb4ac

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

tests/metrics_test.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,22 @@ def test_init_async(fake_async_api_call: AsyncApiCall) -> None:
4242
)
4343
assert metrics.resource_path == "/metrics.json" # noqa: WPS437
4444

45+
import platform
46+
4547

4648
def test_actual_retrieve(actual_metrics: Metrics) -> None:
4749
"""Test that the Metrics object can retrieve metrics on Typesense server and verify response structure."""
4850
response = actual_metrics.retrieve()
4951

50-
assert "system_cpu_active_percentage" in response
52+
if platform.system() == "Linux":
53+
assert "system_cpu_active_percentage" in response
54+
assert "system_network_received_bytes" in response
55+
assert "system_network_sent_bytes" in response
56+
5157
assert "system_disk_total_bytes" in response
5258
assert "system_disk_used_bytes" in response
5359
assert "system_memory_total_bytes" in response
5460
assert "system_memory_used_bytes" in response
55-
assert "system_network_received_bytes" in response
56-
assert "system_network_sent_bytes" in response
5761
assert "typesense_memory_active_bytes" in response
5862
assert "typesense_memory_allocated_bytes" in response
5963
assert "typesense_memory_fragmentation_ratio" in response
@@ -68,13 +72,15 @@ async def test_actual_retrieve_async(actual_async_metrics: AsyncMetrics) -> None
6872
"""Test that the AsyncMetrics object can retrieve metrics on Typesense server and verify response structure."""
6973
response = await actual_async_metrics.retrieve()
7074

71-
assert "system_cpu_active_percentage" in response
75+
if platform.system() == "Linux":
76+
assert "system_cpu_active_percentage" in response
77+
assert "system_network_received_bytes" in response
78+
assert "system_network_sent_bytes" in response
79+
7280
assert "system_disk_total_bytes" in response
7381
assert "system_disk_used_bytes" in response
7482
assert "system_memory_total_bytes" in response
7583
assert "system_memory_used_bytes" in response
76-
assert "system_network_received_bytes" in response
77-
assert "system_network_sent_bytes" in response
7884
assert "typesense_memory_active_bytes" in response
7985
assert "typesense_memory_allocated_bytes" in response
8086
assert "typesense_memory_fragmentation_ratio" in response

0 commit comments

Comments
 (0)