diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2020-10-29 12:53:57 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-29 12:53:57 -0400 |
commit | 8b42a4eefda409dfef9a3d10c9f55a778cae46a1 (patch) | |
tree | 91e4cc793d4d7bd5a96273f611847786e3c462cb /tests/logging/test_remote_handler.py | |
parent | Add ability for access tokens to belong to one user but grant access to anoth... (diff) | |
download | synapse-8b42a4eefda409dfef9a3d10c9f55a778cae46a1.tar.xz |
Gracefully handle a pending logging connection during shutdown. (#8685)
Diffstat (limited to 'tests/logging/test_remote_handler.py')
-rw-r--r-- | tests/logging/test_remote_handler.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/logging/test_remote_handler.py b/tests/logging/test_remote_handler.py index 58ee1f2f3c..4bc27a1d7d 100644 --- a/tests/logging/test_remote_handler.py +++ b/tests/logging/test_remote_handler.py @@ -151,3 +151,19 @@ class RemoteHandlerTestCase(LoggerCleanupMixin, TestCase): + ["warn %s" % (i,) for i in range(15, 20)], logs, ) + + def test_cancel_connection(self): + """ + Gracefully handle the connection being cancelled. + """ + handler = RemoteHandler( + "127.0.0.1", 9000, maximum_buffer=10, _reactor=self.reactor + ) + logger = self.get_logger(handler) + + # Send a message. + logger.info("Hello there, %s!", "wally") + + # Do not accept the connection and shutdown. This causes the pending + # connection to be cancelled (and should not raise any exceptions). + handler.close() |