mirror of
https://github.com/zulip/zulip.git
synced 2025-10-24 16:43:57 +00:00
zilencer: Log bouncer-side info when RemoteRealm creation fails.
This should also be logged on the bouncer side, to give us better debugging information when self-hosters run into this error.
This commit is contained in:
committed by
Tim Abbott
parent
8a76da5953
commit
1532b87910
@@ -2126,6 +2126,7 @@ class AnalyticsBouncerTest(BouncerTestCase):
|
|||||||
handling for this edge case nonetheless.
|
handling for this edge case nonetheless.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
original_server = RemoteZulipServer.objects.get(uuid=self.server.uuid)
|
||||||
# Start by deleting existing registration, to have a clean slate.
|
# Start by deleting existing registration, to have a clean slate.
|
||||||
RemoteRealm.objects.all().delete()
|
RemoteRealm.objects.all().delete()
|
||||||
|
|
||||||
@@ -2151,9 +2152,19 @@ class AnalyticsBouncerTest(BouncerTestCase):
|
|||||||
plan_type=RemoteRealm.PLAN_TYPE_SELF_MANAGED,
|
plan_type=RemoteRealm.PLAN_TYPE_SELF_MANAGED,
|
||||||
)
|
)
|
||||||
|
|
||||||
with self.assertLogs("zulip.analytics", level="WARNING") as m:
|
with (
|
||||||
|
self.assertLogs("zulip.analytics", level="WARNING") as mock_log_host,
|
||||||
|
self.assertLogs("zilencer.views") as mock_log_bouncer,
|
||||||
|
):
|
||||||
send_server_data_to_push_bouncer()
|
send_server_data_to_push_bouncer()
|
||||||
self.assertEqual(m.output, ["WARNING:zulip.analytics:Duplicate registration detected."])
|
self.assertEqual(
|
||||||
|
mock_log_host.output, ["WARNING:zulip.analytics:Duplicate registration detected."]
|
||||||
|
)
|
||||||
|
self.assertIn(
|
||||||
|
"INFO:zilencer.views:"
|
||||||
|
f"update_remote_realm_data_for_server:server:{original_server.id}:IntegrityError creating RemoteRealm rows:",
|
||||||
|
mock_log_bouncer.output[0],
|
||||||
|
)
|
||||||
|
|
||||||
# Servers on Zulip 2.0.6 and earlier only send realm_counts and installation_counts data,
|
# Servers on Zulip 2.0.6 and earlier only send realm_counts and installation_counts data,
|
||||||
# and don't send realmauditlog_rows. Make sure that continues to work.
|
# and don't send realmauditlog_rows. Make sure that continues to work.
|
||||||
|
|||||||
@@ -1060,7 +1060,12 @@ def update_remote_realm_data_for_server(
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
RemoteRealm.objects.bulk_create(new_remote_realms)
|
RemoteRealm.objects.bulk_create(new_remote_realms)
|
||||||
except IntegrityError:
|
except IntegrityError as e:
|
||||||
|
logger.info(
|
||||||
|
"update_remote_realm_data_for_server:server:%s:IntegrityError creating RemoteRealm rows: %s",
|
||||||
|
server.id,
|
||||||
|
e,
|
||||||
|
)
|
||||||
raise JsonableError(_("Duplicate registration detected."))
|
raise JsonableError(_("Duplicate registration detected."))
|
||||||
|
|
||||||
uuid_to_realm_dict = {str(realm.uuid): realm for realm in server_realms_info}
|
uuid_to_realm_dict = {str(realm.uuid): realm for realm in server_realms_info}
|
||||||
|
|||||||
Reference in New Issue
Block a user