Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 7a95c4a

Browse files
committed
fixed up test
1 parent 8ac92d0 commit 7a95c4a

1 file changed

Lines changed: 7 additions & 11 deletions

File tree

tests/system/data/test_metrics.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@
1414

1515
import pytest
1616
import pytest_asyncio
17-
import uuid
18-
import re
1917
import mock
20-
import asyncio
21-
import time
2218
from functools import partial
2319

2420
from google.api_core.exceptions import NotFound, ServiceUnavailable, DeadlineExceeded
@@ -382,24 +378,24 @@ async def test_status_exception(get_all_metrics):
382378
"""
383379
check the subset of rpcs with a single terminal exception
384380
385-
They should have no retries, 1 connectivity errors, a status of UNAVAILABLE
381+
They should have no retries, 1 connectivity errors, a status of NOT_FOUND
386382
Should have default values for cluster and zone
387383
"""
388384
fail_metrics = [m for m in get_all_metrics if m.metric.labels["app_profile"] == "terminal_exception"]
389385
# ensure each expected instrument is present in data
390386
assert any("operation_latencies" in m.metric.type for m in fail_metrics)
391387
assert any("attempt_latencies" in m.metric.type for m in fail_metrics)
392-
assert any("server_latencies" in m.metric.type for m in fail_metrics)
393-
assert any("first_response_latencies" in m.metric.type for m in fail_metrics)
394388
assert any("application_blocking_latencies" in m.metric.type for m in fail_metrics)
395389
assert any("client_blocking_latencies" in m.metric.type for m in fail_metrics)
396390
assert any("connectivity_error_count" in m.metric.type for m in fail_metrics)
391+
# server_latencies, first_response_latencies and retry_count are not expected
392+
assert not any("server_latencies" in m.metric.type for m in fail_metrics)
393+
assert not any("retry_count" in m.metric.type for m in fail_metrics)
394+
assert not any("first_response_latencies" in m.metric.type for m in fail_metrics)
397395
for m in fail_metrics:
398-
# ensure no retries or connectivity errors recorded
399-
assert "retry_count" not in m.metric.type
400396
# if instrument has status label, should be UNAVAILABLE
401397
if "status" in m.metric.labels:
402-
assert m.metric.labels["status"] == "UNAVAILABLE"
398+
assert m.metric.labels["status"] == "NOT_FOUND"
403399
# check for cluster and zone
404400
assert m.resource.labels["zone"] == 'global'
405401
assert m.resource.labels["cluster"] == 'unspecified'
@@ -412,7 +408,7 @@ async def test_status_exception(get_all_metrics):
412408

413409
@pytest.mark.asyncio
414410
@pytest.mark.parametrize("app_profile,final_status", [
415-
("retryn_then_success", "OK"),
411+
("retry_then_success", "OK"),
416412
("retry_then_terminal", "NOT_FOUND"),
417413
("retry_then_timeout", "DEADLINE_EXCEEDED"),
418414
])

0 commit comments

Comments
 (0)