mirror of
https://github.com/element-hq/synapse.git
synced 2026-08-14 20:10:26 +00:00
Remove throwaway Rust HttpClient constructions from tests
These existed only to force the tokio thread pool to start before reactor.run() under the old callWhenRunning-based startup. Now that the pool starts lazily on first use, the constructions (and the make_homeserver overrides that existed solely to host them) are dead weight. The tearDown hooks that fire the reactor shutdown triggers stay: they are still what stops the tokio pool for tests that exercise the Rust /versions handler. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HyuiV3m44ZbK9o24EnMMES
This commit is contained in:
co-authored by
Claude Opus 5
parent
a6557c7989
commit
41cbc96b26
@@ -31,7 +31,6 @@ from synapse.rest import admin
|
||||
from synapse.rest.admin.experimental_features import ExperimentalFeature
|
||||
from synapse.rest.client import login, push_rule, pusher, receipts, room, versions
|
||||
from synapse.server import HomeServer
|
||||
from synapse.synapse_rust.http_client import HttpClient
|
||||
from synapse.types import JsonDict
|
||||
from synapse.util.clock import Clock
|
||||
|
||||
@@ -1233,19 +1232,6 @@ class MSC3881VersionsTestCase(HomeserverTestCase):
|
||||
versions.register_servlets,
|
||||
]
|
||||
|
||||
def make_homeserver(self, reactor: MemoryReactor, clock: Clock) -> HomeServer:
|
||||
hs = self.setup_test_homeserver()
|
||||
|
||||
self._http_client = hs.get_proxied_http_client()
|
||||
# The tokio thread pool is started lazily on first use, so no
|
||||
# reactor startup hooks need to run here.
|
||||
_ = HttpClient(
|
||||
runtime=hs.get_rust_runtime(),
|
||||
user_agent=self._http_client.user_agent.decode("utf8"),
|
||||
)
|
||||
|
||||
return hs
|
||||
|
||||
def tearDown(self) -> None:
|
||||
# MemoryReactor doesn't trigger the shutdown phases, and we want the
|
||||
# Tokio thread pool to be stopped
|
||||
|
||||
@@ -24,7 +24,6 @@ from synapse.api.errors import Codes
|
||||
from synapse.rest import admin
|
||||
from synapse.rest.client import delayed_events, login, room, sync, versions
|
||||
from synapse.server import HomeServer
|
||||
from synapse.synapse_rust.http_client import HttpClient
|
||||
from synapse.types import JsonDict
|
||||
from synapse.util.clock import Clock
|
||||
from synapse.util.duration import Duration
|
||||
@@ -41,19 +40,6 @@ _EVENT_TYPE = "com.example.test"
|
||||
class DelayedEventsUnstableSupportTestCase(HomeserverTestCase):
|
||||
servlets = [versions.register_servlets]
|
||||
|
||||
def make_homeserver(self, reactor: MemoryReactor, clock: Clock) -> HomeServer:
|
||||
hs = self.setup_test_homeserver()
|
||||
|
||||
self._http_client = hs.get_proxied_http_client()
|
||||
# The tokio thread pool is started lazily on first use, so no
|
||||
# reactor startup hooks need to run here.
|
||||
_ = HttpClient(
|
||||
runtime=hs.get_rust_runtime(),
|
||||
user_agent=self._http_client.user_agent.decode("utf8"),
|
||||
)
|
||||
|
||||
return hs
|
||||
|
||||
def tearDown(self) -> None:
|
||||
# MemoryReactor doesn't trigger the shutdown phases, and we want the
|
||||
# Tokio thread pool to be stopped
|
||||
|
||||
@@ -24,7 +24,6 @@ from twisted.internet.testing import MemoryReactor
|
||||
from synapse.rest import admin
|
||||
from synapse.rest.client import login, login_token_request, versions
|
||||
from synapse.server import HomeServer
|
||||
from synapse.synapse_rust.http_client import HttpClient
|
||||
from synapse.util.clock import Clock
|
||||
|
||||
from tests import unittest
|
||||
@@ -48,14 +47,6 @@ class LoginTokenRequestServletTestCase(unittest.HomeserverTestCase):
|
||||
self.hs.config.registration.auto_join_rooms = []
|
||||
self.hs.config.captcha.enable_registration_captcha = False
|
||||
|
||||
self._http_client = self.hs.get_proxied_http_client()
|
||||
# The tokio thread pool is started lazily on first use, so no
|
||||
# reactor startup hooks need to run here.
|
||||
_ = HttpClient(
|
||||
runtime=self.hs.get_rust_runtime(),
|
||||
user_agent=self._http_client.user_agent.decode("utf8"),
|
||||
)
|
||||
|
||||
return self.hs
|
||||
|
||||
def tearDown(self) -> None:
|
||||
|
||||
@@ -22,7 +22,6 @@ from twisted.internet.testing import MemoryReactor
|
||||
from synapse.rest import admin
|
||||
from synapse.rest.client import login, matrixrtc, register, room, versions
|
||||
from synapse.server import HomeServer
|
||||
from synapse.synapse_rust.http_client import HttpClient
|
||||
from synapse.util.clock import Clock
|
||||
|
||||
from tests import unittest
|
||||
@@ -112,19 +111,6 @@ class MatrixRtcVersionsTestCase(HomeserverTestCase):
|
||||
|
||||
servlets = [versions.register_servlets]
|
||||
|
||||
def make_homeserver(self, reactor: MemoryReactor, clock: Clock) -> HomeServer:
|
||||
hs = self.setup_test_homeserver()
|
||||
|
||||
self._http_client = hs.get_proxied_http_client()
|
||||
# The tokio thread pool is started lazily on first use, so no
|
||||
# reactor startup hooks need to run here.
|
||||
_ = HttpClient(
|
||||
runtime=hs.get_rust_runtime(),
|
||||
user_agent=self._http_client.user_agent.decode("utf8"),
|
||||
)
|
||||
|
||||
return hs
|
||||
|
||||
def tearDown(self) -> None:
|
||||
# MemoryReactor doesn't trigger the shutdown phases, and we want the
|
||||
# Tokio thread pool to be stopped
|
||||
|
||||
@@ -17,7 +17,6 @@ from twisted.internet.testing import MemoryReactor
|
||||
from synapse.rest import admin
|
||||
from synapse.rest.client import login, versions
|
||||
from synapse.server import HomeServer
|
||||
from synapse.synapse_rust.http_client import HttpClient
|
||||
from synapse.types import JsonDict
|
||||
from synapse.util.clock import Clock
|
||||
|
||||
@@ -37,19 +36,6 @@ class VersionsTestCase(unittest.HomeserverTestCase):
|
||||
versions.register_servlets,
|
||||
]
|
||||
|
||||
def make_homeserver(self, reactor: MemoryReactor, clock: Clock) -> HomeServer:
|
||||
hs = self.setup_test_homeserver()
|
||||
|
||||
self._http_client = hs.get_proxied_http_client()
|
||||
# The tokio thread pool is started lazily on first use, so no
|
||||
# reactor startup hooks need to run here.
|
||||
_ = HttpClient(
|
||||
runtime=hs.get_rust_runtime(),
|
||||
user_agent=self._http_client.user_agent.decode("utf8"),
|
||||
)
|
||||
|
||||
return hs
|
||||
|
||||
def tearDown(self) -> None:
|
||||
# MemoryReactor doesn't trigger the shutdown phases, and we want the
|
||||
# Tokio thread pool to be stopped
|
||||
|
||||
Reference in New Issue
Block a user