-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: added integration tests for prometheus
[EC-299]
- Loading branch information
Showing
6 changed files
with
63 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
""" | ||
karapace - prometheus instrumentation tests | ||
Copyright (c) 2024 Aiven Ltd | ||
See LICENSE for details | ||
""" | ||
|
||
from http import HTTPStatus | ||
from karapace.client import Client, Result | ||
from karapace.instrumentation.prometheus import PrometheusInstrumentation | ||
from prometheus_client.parser import text_string_to_metric_families | ||
|
||
|
||
async def test_metrics_endpoint(registry_async_client: Client) -> None: | ||
result: Result = await registry_async_client.get( | ||
PrometheusInstrumentation.METRICS_ENDPOINT_PATH, | ||
json_response=False, | ||
) | ||
assert result.status_code == HTTPStatus.OK.value | ||
|
||
|
||
async def test_metrics_endpoint_parsed_response(registry_async_client: Client) -> None: | ||
result: Result = await registry_async_client.get( | ||
PrometheusInstrumentation.METRICS_ENDPOINT_PATH, | ||
json_response=False, | ||
) | ||
metrics = [family.name for family in text_string_to_metric_families(result.json_result)] | ||
assert "karapace_http_requests" in metrics | ||
assert "karapace_http_requests_duration_seconds" in metrics | ||
assert "karapace_http_requests_in_progress" in metrics |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters