Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
send_analytics_to_remote_server: Log connection errors with traceback.
Mateusz Mandera10a1596d969b
diff --git a/zerver/lib/remote_server.py b/zerver/lib/remote_server.pyindex 7877e663f82..e445217850e 100644--- a/zerver/lib/remote_server.py+++ b/zerver/lib/remote_server.py@@ -161,7 +161,7 @@ def send_analytics_to_remote_server() -> None:try:result = send_to_push_bouncer("GET", "server/analytics/status", {})except PushNotificationBouncerRetryLaterError as e:- logging.warning(e.msg)+ logging.warning(e.msg, exc_info=True)returnlast_acked_realm_count_id = result["last_realm_count_id"]diff --git a/zerver/tests/test_push_notifications.py b/zerver/tests/test_push_notifications.pyindex 2820e68729b..e95dfa44f41 100644--- a/zerver/tests/test_push_notifications.py+++ b/zerver/tests/test_push_notifications.py@@ -552,13 +552,12 @@ class AnalyticsBouncerTest(BouncerTestCase):user = self.example_user("hamlet")end_time = self.TIME_ZERO- with responses.RequestsMock() as resp, mock.patch(- "zerver.lib.remote_server.logging.warning"- ) as mock_warning:+ with responses.RequestsMock() as resp, self.assertLogs(level="WARNING") as mock_warning:resp.add(responses.GET, ANALYTICS_STATUS_URL, body=ConnectionError())send_analytics_to_remote_server()- mock_warning.assert_called_once_with(- "ConnectionError while trying to connect to push notification bouncer"+ self.assertIn(+ "WARNING:root:ConnectionError while trying to connect to push notification bouncer\nTraceback ",+ mock_warning.output[0],)self.assertTrue(resp.assert_call_count(ANALYTICS_STATUS_URL, 1))