diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2020-03-21 15:58:53 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2021-09-26 20:01:10 +0900 |
commit | 6d587b94cbaf86a45084c5a65b4c462252bde2db (patch) | |
tree | f48c8574ad099031b8ae2b5379a3d40fac562949 | |
parent | 0f437895034c9dae6301761ba39b8e10bc1f8d86 (diff) | |
download | ruby-openssl-6d587b94cbaf86a45084c5a65b4c462252bde2db.tar.gz |
test/openssl/test_ssl.rb: ignore SSLError when the connection is closed
[ This is a backport to the 2.1 branch. ]
"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 96a481b5728c12d6b5f4d99040ad2c77443c94a2)
-rw-r--r-- | test/test_ssl.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/test/test_ssl.rb b/test/test_ssl.rb index b911de80..5fe233c1 100644 --- a/test/test_ssl.rb +++ b/test/test_ssl.rb @@ -1295,8 +1295,13 @@ end } 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 |