Skip to content

Commit 6d587b9

Browse files
mamerhenium
authored andcommitted
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 96a481b)
1 parent 0f43789 commit 6d587b9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

test/test_ssl.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1295,8 +1295,13 @@ def test_npn_selected_protocol_too_long
12951295
}
12961296
end
12971297

1298+
def readwrite_loop_safe(ctx, ssl)
1299+
readwrite_loop(ctx, ssl)
1300+
rescue OpenSSL::SSL::SSLError
1301+
end
1302+
12981303
def test_close_after_socket_close
1299-
start_server { |port|
1304+
start_server(server_proc: method(:readwrite_loop_safe)) { |port|
13001305
sock = TCPSocket.new("127.0.0.1", port)
13011306
ssl = OpenSSL::SSL::SSLSocket.new(sock)
13021307
ssl.connect

0 commit comments

Comments
 (0)