]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
tests/pytests/utils: handle SSLEOFError docs-develop-ci-o-45qdxc/deployments/4062
authorOto Šťáva <oto.stava@nic.cz>
Tue, 7 May 2024 14:41:42 +0000 (16:41 +0200)
committerOto Šťáva <oto.stava@nic.cz>
Mon, 13 May 2024 13:09:22 +0000 (15:09 +0200)
It used to just throw BrokenPipeError, but newer versions of Python have
a separate exception for when the connection is closed in violation of
TLS rules, which Knot Resolver does deliberately so as to not waste time
on properly closing TLS connections with misbehaving peers.

tests/pytests/utils.py

index 7792c047c1607aaa3af30bb4f940e01d412d2fc4..8af71aadfb926b2798c7cc4ae8dca4878c43da6d 100644 (file)
@@ -99,7 +99,7 @@ def ping_alive(sock, msgid=None):
 
 @contextmanager
 def expect_kresd_close(rst_ok=False):
-    with pytest.raises(BrokenPipeError):
+    with pytest.raises((BrokenPipeError, ssl.SSLEOFError)):
         try:
             time.sleep(0.2)  # give kresd time to close connection with TCP FIN
             yield