Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions lib/iris/tests/cluster/controller/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import pytest

from iris.managed_thread import thread_container_scope
from iris.cluster.bundle import BundleStore
from iris.cluster.constraints import (
Constraint,
Expand Down Expand Up @@ -112,6 +113,17 @@ def close(self) -> None:
pass


@pytest.fixture(autouse=True)
def _isolated_thread_container():
"""Install a per-test ThreadContainer so Controller-spawned threads are
stopped at test end. Without this, tests that construct a Controller but
never call ``.stop()`` leak the uvicorn log-server thread and hit the 5s
leak-detection wait in the top-level ``_thread_cleanup`` fixture.
"""
with thread_container_scope(name="controller-test"):
yield


@pytest.fixture
def state():
"""Create a fresh ControllerTransitions with temp DB and log store."""
Expand Down
Loading