diff options
author | Mathieu Velten <mathieuv@matrix.org> | 2023-06-16 12:15:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-16 10:15:12 +0000 |
commit | f63d4a3a65e95d3845c43a9dd2893605b06f164a (patch) | |
tree | 235555c85b5fb77c2f61569364464c0db8682483 /tests | |
parent | Fix unsafe hotserving behaviour for non-multimedia uploads. (#15680) (diff) | |
download | synapse-f63d4a3a65e95d3845c43a9dd2893605b06f164a.tar.xz |
Regularly try to wake up dests instead of waiting for next PDU/EDU (#15743)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/federation/test_federation_catch_up.py | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/tests/federation/test_federation_catch_up.py b/tests/federation/test_federation_catch_up.py index 391ae51707..b290b020a2 100644 --- a/tests/federation/test_federation_catch_up.py +++ b/tests/federation/test_federation_catch_up.py @@ -431,28 +431,24 @@ class FederationCatchUpTestCases(FederatingHomeserverTestCase): # ACT: call _wake_destinations_needing_catchup # patch wake_destination to just count the destinations instead - woken = [] + woken = set() def wake_destination_track(destination: str) -> None: - woken.append(destination) + woken.add(destination) self.federation_sender.wake_destination = wake_destination_track # type: ignore[assignment] - # cancel the pre-existing timer for _wake_destinations_needing_catchup - # this is because we are calling it manually rather than waiting for it - # to be called automatically - assert self.federation_sender._catchup_after_startup_timer is not None - self.federation_sender._catchup_after_startup_timer.cancel() - - self.get_success( - self.federation_sender._wake_destinations_needing_catchup(), by=5.0 - ) + # We wait quite long so that all dests can be woken up, since there is a delay + # between them. + self.pump(by=5.0) # ASSERT (_wake_destinations_needing_catchup): # - all remotes are woken up, save for zzzerver self.assertNotIn("zzzerver", woken) - # - all destinations are woken exactly once; they appear once in woken. - self.assertCountEqual(woken, server_names[:-1]) + # - all destinations are woken, potentially more than once, since the + # wake up is called regularly and we don't ack in this test that a transaction + # has been successfully sent. + self.assertCountEqual(woken, set(server_names[:-1])) def test_not_latest_event(self) -> None: """Test that we send the latest event in the room even if its not ours.""" |