tornado: Track which queues were inherited from old Tornado instances.

This commit is contained in:
Alex Vandiver
2024-02-07 21:03:15 +00:00
committed by Tim Abbott
parent fc41d6085b
commit 1d3813ec4f
3 changed files with 47 additions and 3 deletions

View File

@@ -251,6 +251,7 @@ from zerver.tornado.event_queue import (
allocate_client_descriptor,
clear_client_event_queues_for_testing,
create_heartbeat_event,
mark_clients_to_reload,
send_web_reload_client_events,
)
from zerver.views.realm_playgrounds import access_playground_by_id
@@ -288,6 +289,7 @@ class BaseAction(ZulipTestCase):
pronouns_field_type_supported: bool = True,
linkifier_url_template: bool = True,
user_list_incomplete: bool = False,
client_is_old: bool = False,
) -> List[Dict[str, Any]]:
"""
Make sure we have a clean slate of client descriptors for these tests.
@@ -336,6 +338,9 @@ class BaseAction(ZulipTestCase):
user_list_incomplete=user_list_incomplete,
)
if client_is_old:
mark_clients_to_reload([client.event_queue.id])
# We want even those `send_event` calls which have been hooked to
# `transaction.on_commit` to execute in tests.
# See the comment in `ZulipTestCase.capture_send_event_calls`.
@@ -3457,8 +3462,14 @@ class NormalActionsTest(BaseAction):
check_has_zoom_token("events[0]", events[0], value=False)
def test_web_reload_client_event(self) -> None:
self.verify_action(
lambda: send_web_reload_client_events(),
client_is_old=False,
num_events=0,
state_change_expected=False,
)
with self.assertRaises(WebReloadClientError):
self.verify_action(lambda: send_web_reload_client_events())
self.verify_action(lambda: send_web_reload_client_events(), client_is_old=True)
def test_display_setting_event_not_sent(self) -> None:
events = self.verify_action(