diff options
author | David Robertson <davidr@element.io> | 2022-10-31 13:02:07 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-31 13:02:07 +0000 |
commit | 2bb2c32e8ed5642a5bf3ba1e8c49e10cecc88905 (patch) | |
tree | b25c0eb8017de0c12dc176dbae2679d9177c0cbf /tests/metrics/test_metrics.py | |
parent | Prevent federation user keys query from returning device names if disallowed ... (diff) | |
download | synapse-2bb2c32e8ed5642a5bf3ba1e8c49e10cecc88905.tar.xz |
Avoid incrementing bg process utime/stime counters by negative durations (#14323)
Diffstat (limited to '')
-rw-r--r-- | tests/metrics/test_metrics.py (renamed from tests/test_metrics.py) | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/test_metrics.py b/tests/metrics/test_metrics.py index 1a70eddc9b..bddc4228bc 100644 --- a/tests/test_metrics.py +++ b/tests/metrics/test_metrics.py @@ -12,6 +12,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +from typing_extensions import Protocol + try: from importlib import metadata except ImportError: @@ -52,7 +54,11 @@ def get_sample_labels_value(sample): class TestMauLimit(unittest.TestCase): def test_basic(self): - gauge = InFlightGauge( + class MetricEntry(Protocol): + foo: int + bar: int + + gauge: InFlightGauge[MetricEntry] = InFlightGauge( "test1", "", labels=["test_label"], sub_metrics=["foo", "bar"] ) @@ -146,7 +152,7 @@ class CacheMetricsTests(unittest.HomeserverTestCase): Caches produce metrics reflecting their state when scraped. """ CACHE_NAME = "cache_metrics_test_fgjkbdfg" - cache = DeferredCache(CACHE_NAME, max_entries=777) + cache: DeferredCache[str, str] = DeferredCache(CACHE_NAME, max_entries=777) items = { x.split(b"{")[0].decode("ascii"): x.split(b" ")[1].decode("ascii") |