Skip to content

Commit

Permalink
test/openssl/test_ssl.rb: ignore SSLError when the connection is closed
Browse files Browse the repository at this point in the history
"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.
  • Loading branch information
mame committed Mar 21, 2020
1 parent 39cefa6 commit be76e86
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/openssl/test_ssl.rb
Expand Up @@ -1398,8 +1398,13 @@ def test_npn_selected_protocol_too_long
}
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
Expand Down

0 comments on commit be76e86

Please sign in to comment.