[前][次][番号順一覧][スレッド一覧]

ruby-changes:60526

From: Yusuke <ko1@a...>
Date: Thu, 26 Mar 2020 23:59:40 +0900 (JST)
Subject: [ruby-changes:60526] c9a7643a7e (ruby_2_7): test/openssl/test_ssl.rb: ignore SSLError when the connection is closed

https://git.ruby-lang.org/ruby.git/commit/?id=c9a7643a7e

From c9a7643a7e5993975e7e8c985df157d73b16a490 Mon Sep 17 00:00:00 2001
From: Yusuke Endoh <mame@r...>
Date: Sat, 21 Mar 2020 15:46:33 +0900
Subject: test/openssl/test_ssl.rb: ignore SSLError when the connection is
 closed

"test_close_after_socket_close" checks if ssl.close is no-op even after
the wrapped socket is closed.  The test itself is fair, but the other
endpoint that is reading the SSL connection may fail with SSLError:
"SSL_read: unexpected eof while reading" in some environments:

https://github.com/ruby/ruby/actions/runs/60085389 (MinGW)
https://rubyci.org/logs/rubyci.s3.amazonaws.com/android28-x86_64/ruby-master/log/20200321T034442Z.fail.html.gz
```
  1) Failure:
OpenSSL::TestSSL#test_close_after_socket_close [D:/a/ruby/ruby/src/test/openssl/utils.rb:299]:
exceptions on 1 threads:
SSL_read: unexpected eof while reading
```

This changeset rescues and ignores the SSLError in the test.

(cherry picked from commit be76e86e69106c6906322dc30aa75c3ff65da63c)

diff --git a/test/openssl/test_ssl.rb b/test/openssl/test_ssl.rb
index 940bc13..45a9add 100644
--- a/test/openssl/test_ssl.rb
+++ b/test/openssl/test_ssl.rb
@@ -1270,8 +1270,13 @@ end https://github.com/ruby/ruby/blob/trunk/test/openssl/test_ssl.rb#L1270
     }
   end
 
+  def readwrite_loop_safe(ctx, ssl)
+    readwrite_loop(ctx, ssl)
+  rescue OpenSSL::SSL::SSLError
+  end
+
   def test_close_after_socket_close
-    start_server { |port|
+    start_server(server_proc: method(:readwrite_loop_safe)) { |port|
       sock = TCPSocket.new("127.0.0.1", port)
       ssl = OpenSSL::SSL::SSLSocket.new(sock)
       ssl.connect
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]