Change-detectors, tautologies, source-reading tests, redundant duplicates, mock-echo tests and dead/unrunnable tests. Per-test rationale in the lane ledger (category + reason for every removal).
40 lines
979 B
Python
40 lines
979 B
Python
"""Tests for gateway.memory_monitor — periodic process memory logging.
|
|
|
|
Ported from cline/cline#10343. The module logs a structured
|
|
``[MEMORY] rss=...MB ...`` line periodically so long-running gateway
|
|
leaks show up as a time series in agent.log / gateway.log.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
import pytest
|
|
|
|
from gateway import memory_monitor as mm
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def _ensure_monitor_stopped():
|
|
"""Every test starts from a clean state and leaves one behind."""
|
|
mm.stop_memory_monitoring(timeout=1.0)
|
|
yield
|
|
mm.stop_memory_monitoring(timeout=1.0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_double_start_is_noop():
|
|
assert mm.start_memory_monitoring(interval_seconds=3600.0) is True
|
|
assert mm.start_memory_monitoring(interval_seconds=3600.0) is False
|
|
assert mm.is_running() is True
|
|
|
|
|
|
def test_stop_ends_monitoring():
|
|
mm.start_memory_monitoring(interval_seconds=3600.0)
|
|
mm.stop_memory_monitoring(timeout=1.0)
|
|
assert mm.is_running() is False
|
|
|
|
|