[iris] Stop controller-test RemoteLogHandler leak across test session#5045
[iris] Stop controller-test RemoteLogHandler leak across test session#5045
Conversation
Controller.__init__ attaches a RemoteLogHandler to the iris logger and spawns a LogPusher drain thread; tests that constructed a Controller without calling stop() leaked both across the session, corrupting later tests that monkeypatch LogServiceClientSync. Introduce a shared make_controller fixture that tracks and stops every controller at teardown, migrate the per-file helpers, and make Controller.stop() idempotent. Also cap pytest assertion truncation so a future leak can no longer flood CI logs with protobuf reprs.
|
Claude finished @rjpower's task in 4m 21s —— View job ReviewOverall: This is a solid, well-scoped fix for a real test-isolation bug. The shared 1. Vestigial
|
|
@claude please address PR comments |
|
Claude finished @rjpower's task in 9m 7s —— View job Addressed all PR review commentsPushed as
Testing
|
…en teardown - Remove six vestigial controller._db.close() calls in test_checkpoint.py now that the make_controller fixture stops the controller (which closes the DB) at teardown. Each redundant close blocked for ~1s draining the read pool. - Bump pytest>=8.4 in lib/iris dev deps so truncation_limit_lines/chars aren't silently dropped on fresh resolves that pick 8.3.x. - Make the make_controller teardown robust to per-controller stop() failures: collect errors, stop every controller, then re-raise. - Expand the make_controller docstring to cover db= / provider= injection. - Alphabetize the iris.cluster.controller.* import block in conftest.py. Co-authored-by: Russell Power <rjpower@users.noreply.github.com>
Controller.init attaches a RemoteLogHandler to the iris logger and spawns a LogPusher drain thread; tests that constructed a Controller without calling stop() leaked both across the session, so later tests that monkeypatched LogServiceClientSync could receive the stale backlog (seen as flaky CI failures with tens of KB of protobuf repr). Introduces a shared make_controller fixture that tracks and stops every controller at teardown, migrates per-file helpers to use it, and makes Controller.stop() idempotent. Also caps pytest assertion truncation so a future leak cannot flood CI logs again.