Skip to content

Commit

Permalink
Make more calls and verify that no metric incresed more than expected
Browse files Browse the repository at this point in the history
  • Loading branch information
mdujava committed Nov 19, 2024
1 parent 0ec51d9 commit 3ad4de9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions testsuite/tests/prometheus/system/test_internal_calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
]


REQUEST_NUM = 42


@pytest.fixture(scope="session")
def backend_listener_url(testconfig):
"""
Expand Down Expand Up @@ -76,7 +79,8 @@ def test_utilization(url, prometheus, application, backend_listener_url, auth_he

service_id = application.service.entity_id
app_plan_id = application.entity["plan_id"]
requests.get(url.format(backend_listener_url, service_id, app_plan_id), verify=False, headers=auth_headers)
for _ in range(REQUEST_NUM):
requests.get(url.format(backend_listener_url, service_id, app_plan_id), verify=False, headers=auth_headers)

# prometheus is downloading metrics periodicity, we need to wait for next fetch
prometheus.wait_on_next_scrape("backend-worker")
Expand All @@ -91,7 +95,9 @@ def test_utilization(url, prometheus, application, backend_listener_url, auth_he
lambda x: x["metric"]["controller"].startswith("admin/api"),
)

assert counts_after == counts_before
for key, count in counts_after.items():
if int(count) >= int(counts_before[key]) + REQUEST_NUM:
assert counts_after == counts_before, f"looks like {key} is increased by internal calls"


def extract_call_metrics(prometheus, query, container, predicate=None):
Expand Down

0 comments on commit 3ad4de9

Please sign in to comment.