WIP: Development changes moved from master

- Modified Grafana dashboards
- Updated message sender and metrics collector
- Added new rate limiting dashboard
- Removed count_tests.py
This commit is contained in:
2025-09-05 01:29:28 +03:00
parent 7d08575512
commit 40968dd075
7 changed files with 1584 additions and 93 deletions

View File

@@ -252,21 +252,21 @@ class TestMetricsCollector:
def test_check_process_status_pid_file(self, metrics_collector, tmp_path):
"""Тест проверки статуса процесса по PID файлу"""
# Создаем временный PID файл
pid_file = tmp_path / "helper_bot.pid"
pid_file = tmp_path / "test_bot.pid"
pid_file.write_text("12345")
# Временно заменяем путь к PID файлу
original_pid_files = metrics_collector.pid_files.copy()
metrics_collector.pid_files['helper_bot'] = str(pid_file)
metrics_collector.pid_files['test_bot'] = str(pid_file)
with patch('metrics_collector.psutil.pid_exists', return_value=True), \
patch('metrics_collector.psutil.Process') as mock_process:
with patch('infra.monitoring.metrics_collector.psutil.pid_exists', return_value=True), \
patch('infra.monitoring.metrics_collector.psutil.Process') as mock_process:
mock_proc = Mock()
mock_proc.create_time.return_value = time.time() - 3600
mock_process.return_value = mock_proc
status, uptime = metrics_collector.check_process_status('helper_bot')
status, uptime = metrics_collector.check_process_status('test_bot')
assert status == ""
assert "Uptime" in uptime