mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Reduce run-times of tests by advancing the reactor less (#7757)
This commit is contained in:
parent
9cfc120233
commit
a466b67972
1
changelog.d/7757.misc
Normal file
1
changelog.d/7757.misc
Normal file
@ -0,0 +1 @@
|
|||||||
|
Reduce run times of some unit tests by advancing the reactor a fewer number of times.
|
@ -256,7 +256,7 @@ class StatsRoomTests(unittest.HomeserverTestCase):
|
|||||||
# self.handler.notify_new_event()
|
# self.handler.notify_new_event()
|
||||||
|
|
||||||
# We need to let the delta processor advance…
|
# We need to let the delta processor advance…
|
||||||
self.pump(10 * 60)
|
self.reactor.advance(10 * 60)
|
||||||
|
|
||||||
# Get the slices! There should be two -- day 1, and day 2.
|
# Get the slices! There should be two -- day 1, and day 2.
|
||||||
r = self.get_success(self.store.get_statistics_for_subject("room", room_1, 0))
|
r = self.get_success(self.store.get_statistics_for_subject("room", room_1, 0))
|
||||||
|
@ -508,6 +508,6 @@ class FederationClientTests(HomeserverTestCase):
|
|||||||
self.assertFalse(conn.disconnecting)
|
self.assertFalse(conn.disconnecting)
|
||||||
|
|
||||||
# wait for a while
|
# wait for a while
|
||||||
self.pump(120)
|
self.reactor.advance(120)
|
||||||
|
|
||||||
self.assertTrue(conn.disconnecting)
|
self.assertTrue(conn.disconnecting)
|
||||||
|
@ -170,7 +170,7 @@ class EmailPusherTests(HomeserverTestCase):
|
|||||||
last_stream_ordering = pushers[0]["last_stream_ordering"]
|
last_stream_ordering = pushers[0]["last_stream_ordering"]
|
||||||
|
|
||||||
# Advance time a bit, so the pusher will register something has happened
|
# Advance time a bit, so the pusher will register something has happened
|
||||||
self.pump(100)
|
self.pump(10)
|
||||||
|
|
||||||
# It hasn't succeeded yet, so the stream ordering shouldn't have moved
|
# It hasn't succeeded yet, so the stream ordering shouldn't have moved
|
||||||
pushers = self.get_success(
|
pushers = self.get_success(
|
||||||
|
@ -271,7 +271,7 @@ class CleanupExtremDummyEventsTestCase(HomeserverTestCase):
|
|||||||
|
|
||||||
# Pump the reactor repeatedly so that the background updates have a
|
# Pump the reactor repeatedly so that the background updates have a
|
||||||
# chance to run.
|
# chance to run.
|
||||||
self.pump(10 * 60)
|
self.pump(20)
|
||||||
|
|
||||||
latest_event_ids = self.get_success(
|
latest_event_ids = self.get_success(
|
||||||
self.store.get_latest_event_ids_in_room(self.room_id)
|
self.store.get_latest_event_ids_in_room(self.room_id)
|
||||||
|
@ -87,7 +87,7 @@ class RoomMemberStoreTestCase(unittest.HomeserverTestCase):
|
|||||||
self.inject_room_member(self.room, self.u_bob, Membership.JOIN)
|
self.inject_room_member(self.room, self.u_bob, Membership.JOIN)
|
||||||
self.inject_room_member(self.room, self.u_charlie.to_string(), Membership.JOIN)
|
self.inject_room_member(self.room, self.u_charlie.to_string(), Membership.JOIN)
|
||||||
|
|
||||||
self.pump(20)
|
self.pump()
|
||||||
|
|
||||||
self.assertTrue("_known_servers_count" not in self.store.__dict__.keys())
|
self.assertTrue("_known_servers_count" not in self.store.__dict__.keys())
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ class RoomMemberStoreTestCase(unittest.HomeserverTestCase):
|
|||||||
# Initialises to 1 -- itself
|
# Initialises to 1 -- itself
|
||||||
self.assertEqual(self.store._known_servers_count, 1)
|
self.assertEqual(self.store._known_servers_count, 1)
|
||||||
|
|
||||||
self.pump(20)
|
self.pump()
|
||||||
|
|
||||||
# No rooms have been joined, so technically the SQL returns 0, but it
|
# No rooms have been joined, so technically the SQL returns 0, but it
|
||||||
# will still say it knows about itself.
|
# will still say it knows about itself.
|
||||||
@ -111,7 +111,7 @@ class RoomMemberStoreTestCase(unittest.HomeserverTestCase):
|
|||||||
self.inject_room_member(self.room, self.u_bob, Membership.JOIN)
|
self.inject_room_member(self.room, self.u_bob, Membership.JOIN)
|
||||||
self.inject_room_member(self.room, self.u_charlie.to_string(), Membership.JOIN)
|
self.inject_room_member(self.room, self.u_charlie.to_string(), Membership.JOIN)
|
||||||
|
|
||||||
self.pump(20)
|
self.pump(1)
|
||||||
|
|
||||||
# It now knows about Charlie's server.
|
# It now knows about Charlie's server.
|
||||||
self.assertEqual(self.store._known_servers_count, 2)
|
self.assertEqual(self.store._known_servers_count, 2)
|
||||||
|
@ -91,7 +91,7 @@ class RetryLimiterTestCase(HomeserverTestCase):
|
|||||||
#
|
#
|
||||||
# one more go, with success
|
# one more go, with success
|
||||||
#
|
#
|
||||||
self.pump(MIN_RETRY_INTERVAL * RETRY_MULTIPLIER * 2.0)
|
self.reactor.advance(MIN_RETRY_INTERVAL * RETRY_MULTIPLIER * 2.0)
|
||||||
limiter = self.get_success(get_retry_limiter("test_dest", self.clock, store))
|
limiter = self.get_success(get_retry_limiter("test_dest", self.clock, store))
|
||||||
|
|
||||||
self.pump(1)
|
self.pump(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user