Align existing test

This commit is contained in:
Eric Eastwood
2026-04-02 22:27:12 -05:00
parent 154b41d0fe
commit edfcb539ca
2 changed files with 16 additions and 5 deletions
+12 -2
View File
@@ -51,6 +51,7 @@ from synapse.types import (
create_requester,
)
from synapse.util.clock import Clock
from synapse.util.duration import Duration
import tests.unittest
import tests.utils
@@ -1058,13 +1059,22 @@ class SyncTestCase(tests.unittest.HomeserverTestCase):
)
# This should block waiting for the presence stream to update
self.pump()
#
# Advance time a little bit to make the
# `wait_for_stream_token(...)` sleep loop iterate.
self.reactor.advance(Duration(seconds=2).as_secs())
# It should still not be done yet
self.assertFalse(sync_d.called)
# Marking the stream ID as persisted should unblock the request.
self.get_success(ctx_mgr.__aexit__(None, None, None))
self.get_success(sync_d, by=1.0)
# Advance time to make another iteration of `wait_for_stream_token(...)` sleep
# loop so it sees that we're finally caught up now.
self.reactor.advance(Duration(seconds=1).as_secs())
# Done waiting
self.get_success(sync_d)
@parameterized.expand(
[(key,) for key in StreamKeyType.__members__.values()],
+4 -3
View File
@@ -137,9 +137,10 @@ class NotifierTestCase(tests.unittest.HomeserverTestCase):
def test_wait_for_multi_writer_stream_token_with_invalid_future_sync_token(
self,
) -> None:
"""Like the previous test, except we give a token that has a stream
position ahead of what is in the DB, i.e. its invalid and we shouldn't
wait for the stream to advance (as it may never do so).
"""
Like `test_wait_for_multi_writer_stream_token_with_future_sync_token`, except we
give a token that has a stream position ahead of what is in the DB, i.e. its
invalid and we shouldn't wait for the stream to advance (as it may never do so).
This can happen due to older versions of Synapse giving out stream
positions without persisting them in the DB, and so on restart the