Skip to content

Commit

Permalink
make generated metric exposition test more exhaustive
Browse files Browse the repository at this point in the history
  • Loading branch information
lilioid committed Feb 12, 2024
1 parent 1fb8bf7 commit ec09ae6
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import pytest
from django.shortcuts import resolve_url
from django.test import Client
from prometheus_client.parser import text_string_to_metric_families


def test_metric_endpoint_returns_200(client: Client):
@pytest.mark.django_db
def test_metric_endpoint_returns_valid_prometheus_data(client: Client):
response = client.get(resolve_url("prometheus_metrics"))
assert response.status_code == 200
metrics = list(text_string_to_metric_families(response.content.decode("UTF-8")))
assert len(metrics) > 0

0 comments on commit ec09ae6

Please sign in to comment.