/
Undeadguy
/
synapse
Обзор
Документация
Войти
/
Undeadguy
/
synapse
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
tests/metrics/test_background_process_metrics.py
19 строк
774 B
David Robertson
Avoid incrementing bg process utime/stime counters by negative durations (#14323)
31 окт 2022, 16:02
Не верифицирован
31 окт 2022, 16:02
2bb2c32
Код
Авторство
О чём код?
from unittest import TestCase as StdlibTestCase from unittest.mock import Mock from synapse.logging.context import ContextResourceUsage, LoggingContext from synapse.metrics.background_process_metrics import _BackgroundProcess class TestBackgroundProcessMetrics(StdlibTestCase): def test_update_metrics_with_negative_time_diff(self) -> None: """We should ignore negative reported utime and stime differences""" usage = ContextResourceUsage() usage.ru_stime = usage.ru_utime = -1.0 mock_logging_context = Mock(spec=LoggingContext) mock_logging_context.get_resource_usage.return_value = usage process = _BackgroundProcess("test process", mock_logging_context) # Should not raise process.update_metrics()