diff --git a/zerver/lib/server_initialization.py b/zerver/lib/server_initialization.py index e8a0fd40ae..9d4261388c 100644 --- a/zerver/lib/server_initialization.py +++ b/zerver/lib/server_initialization.py @@ -53,6 +53,7 @@ def create_internal_realm() -> None: # just ensures these get low IDs in production, and in development # avoids an extra database write for the first HTTP request in # most tests. + get_client("Internal") get_client("website") get_client("ZulipMobile") get_client("ZulipElectron") diff --git a/zerver/tests/test_email_mirror.py b/zerver/tests/test_email_mirror.py index a01f02a2ce..b72286cce4 100644 --- a/zerver/tests/test_email_mirror.py +++ b/zerver/tests/test_email_mirror.py @@ -1027,7 +1027,7 @@ class TestMissedMessageEmailMessages(ZulipTestCase): incoming_valid_message["To"] = mm_address incoming_valid_message["Reply-to"] = self.example_email("othello") - with self.assert_database_query_count(17): + with self.assert_database_query_count(16): process_message(incoming_valid_message) # confirm that Hamlet got the message @@ -1072,7 +1072,7 @@ class TestMissedMessageEmailMessages(ZulipTestCase): incoming_valid_message["To"] = mm_address incoming_valid_message["Reply-to"] = self.example_email("cordelia") - with self.assert_database_query_count(22): + with self.assert_database_query_count(21): process_message(incoming_valid_message) # Confirm Iago received the message. @@ -1124,7 +1124,7 @@ class TestMissedMessageEmailMessages(ZulipTestCase): incoming_valid_message["To"] = mm_address incoming_valid_message["Reply-to"] = user_profile.delivery_email - with self.assert_database_query_count(18): + with self.assert_database_query_count(17): process_message(incoming_valid_message) # confirm that Hamlet got the message diff --git a/zerver/tests/test_message_edit.py b/zerver/tests/test_message_edit.py index 4e1dddfe9f..15c81f2c4e 100644 --- a/zerver/tests/test_message_edit.py +++ b/zerver/tests/test_message_edit.py @@ -3785,7 +3785,7 @@ class EditMessageTest(EditMessageTestCase): "iago", "test move stream", "new stream", "test" ) - with self.assert_database_query_count(56), self.assert_memcached_count(14): + with self.assert_database_query_count(55), self.assert_memcached_count(14): result = self.client_patch( f"/json/messages/{msg_id}", { diff --git a/zerver/tests/test_signup.py b/zerver/tests/test_signup.py index 5a16be39fd..928ba8b4da 100644 --- a/zerver/tests/test_signup.py +++ b/zerver/tests/test_signup.py @@ -931,7 +931,7 @@ class LoginTest(ZulipTestCase): # seem to be any O(N) behavior. Some of the cache hits are related # to sending messages, such as getting the welcome bot, looking up # the alert words for a realm, etc. - with self.assert_database_query_count(105), self.assert_memcached_count(18): + with self.assert_database_query_count(104), self.assert_memcached_count(18): with self.captureOnCommitCallbacks(execute=True): self.register(self.nonreg_email("test"), "test") diff --git a/zerver/tests/test_subs.py b/zerver/tests/test_subs.py index c25c3474d2..55981ffd27 100644 --- a/zerver/tests/test_subs.py +++ b/zerver/tests/test_subs.py @@ -4597,7 +4597,7 @@ class SubscriptionAPITest(ZulipTestCase): realm = get_realm("zulip") streams_to_sub = ["multi_user_stream"] with self.capture_send_event_calls(expected_num_events=5) as events: - with self.assert_database_query_count(37): + with self.assert_database_query_count(36): self.common_subscribe_to_streams( self.test_user, streams_to_sub, @@ -5522,7 +5522,7 @@ class SubscriptionAPITest(ZulipTestCase): ] # Test creating a public stream when realm does not have a notification stream. - with self.assert_database_query_count(37): + with self.assert_database_query_count(36): self.common_subscribe_to_streams( self.test_user, [new_streams[0]], @@ -6011,7 +6011,7 @@ class GetSubscribersTest(ZulipTestCase): polonius.id, ] - with self.assert_database_query_count(47): + with self.assert_database_query_count(46): self.common_subscribe_to_streams( self.user_profile, streams, diff --git a/zerver/tests/test_users.py b/zerver/tests/test_users.py index 2df8313429..aea4dfdf17 100644 --- a/zerver/tests/test_users.py +++ b/zerver/tests/test_users.py @@ -867,7 +867,7 @@ class QueryCountTest(ZulipTestCase): prereg_user = PreregistrationUser.objects.get(email="fred@zulip.com") - with self.assert_database_query_count(94): + with self.assert_database_query_count(93): with self.assert_memcached_count(23): with self.capture_send_event_calls(expected_num_events=11) as events: fred = do_create_user(