mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-13 23:11:40 +00:00
test(prometheus): satisfy strict caller identity lint
This commit is contained in:
parent
8d0c23ea64
commit
a3ce23e80a
1 changed files with 15 additions and 1 deletions
|
|
@ -102,7 +102,10 @@ def test_invalid_caller_identity_mode_fails_during_prometheus_initialization(
|
|||
):
|
||||
_set_caller_identity(monkeypatch, "invalid")
|
||||
|
||||
with pytest.raises(ValueError) as exc_info:
|
||||
with pytest.raises(
|
||||
ValueError,
|
||||
match="prometheus_deployment_and_latency_caller_identity",
|
||||
) as exc_info:
|
||||
PrometheusLogger()
|
||||
|
||||
message = str(exc_info.value)
|
||||
|
|
@ -111,6 +114,17 @@ def test_invalid_caller_identity_mode_fails_during_prometheus_initialization(
|
|||
assert accepted_value in message
|
||||
|
||||
|
||||
def test_label_resolution_rejects_non_string_class_labels(monkeypatch: pytest.MonkeyPatch):
|
||||
monkeypatch.setattr(
|
||||
PrometheusMetricLabels,
|
||||
"litellm_deployment_total_requests",
|
||||
["api_key_alias", 1],
|
||||
)
|
||||
|
||||
with pytest.raises(TypeError, match=r"Prometheus labels .* must be strings"):
|
||||
PrometheusMetricLabels.get_labels("litellm_deployment_total_requests")
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("mode", "include_labels", "is_valid"),
|
||||
(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue