From 2a3f2412b704cfd4eb34c90e2032e3e2d40d3ae2 Mon Sep 17 00:00:00 2001 From: Kazuki Yamaguchi Date: Fri, 20 Dec 2024 20:48:54 +0900 Subject: [PATCH] [ruby/openssl] ssl: fix flaky test case test_ctx_client_session_cb_tls13_exception In the test case, the client raises an exception in the session_new_cb and may not cleanly close the connection. Let's ignore exceptions raised at the server side. Fixes: https://github.com/ruby/openssl/issues/828 https://github.com/ruby/openssl/commit/210ba0334a --- test/openssl/test_ssl_session.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/openssl/test_ssl_session.rb b/test/openssl/test_ssl_session.rb index d9b49a2058..25ba6a8c45 100644 --- a/test/openssl/test_ssl_session.rb +++ b/test/openssl/test_ssl_session.rb @@ -277,7 +277,11 @@ __EOS__ omit "TLS 1.3 not supported" unless tls13_supported? omit "LibreSSL does not call session_new_cb in TLS 1.3" if libressl? - start_server do |port| + server_proc = lambda do |ctx, ssl| + readwrite_loop(ctx, ssl) + rescue SystemCallError, OpenSSL::SSL::SSLError + end + start_server(server_proc: server_proc) do |port| ctx = OpenSSL::SSL::SSLContext.new ctx.min_version = :TLS1_3 ctx.session_cache_mode = OpenSSL::SSL::SSLContext::SESSION_CACHE_CLIENT