summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi SHIBATA <[email protected]>2024-07-17 12:49:36 +0900
committerHiroshi SHIBATA <[email protected]>2024-07-17 17:37:57 +0900
commit2a12e4ffec99f1e7e83b3b2bdfbec1ace2b1202f (patch)
tree5a58b6d5ada346092e95ded1e05a4c8e89b67242
parente55bae4a67311b7934fdeb6cb6062d1424671b25 (diff)
To avoid fd leak with fetch request for SSL server
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/11171
-rw-r--r--test/net/http/test_https.rb1
-rw-r--r--test/net/http/utils.rb1
-rw-r--r--test/open-uri/test_ssl.rb1
-rw-r--r--test/open-uri/utils.rb1
-rw-r--r--test/rubygems/test_gem_remote_fetcher_local_ssl_server.rb1
5 files changed, 5 insertions, 0 deletions
diff --git a/test/net/http/test_https.rb b/test/net/http/test_https.rb
index cbeed53588..e860c8745e 100644
--- a/test/net/http/test_https.rb
+++ b/test/net/http/test_https.rb
@@ -321,6 +321,7 @@ class TestNetHTTPSIdentityVerifyFailure < Test::Unit::TestCase
@log_tester = lambda {|_| }
ex = assert_raise(OpenSSL::SSL::SSLError){
http.request_get("/") {|res| }
+ sleep 0.5
}
re_msg = /certificate verify failed|hostname \"#{HOST_IP}\" does not match/
assert_match(re_msg, ex.message)
diff --git a/test/net/http/utils.rb b/test/net/http/utils.rb
index a397293aec..39f4152ef3 100644
--- a/test/net/http/utils.rb
+++ b/test/net/http/utils.rb
@@ -252,6 +252,7 @@ module TestNetHTTPUtils
end
def teardown
+ sleep 0.5 if @config['ssl_enable']
if @server
@server.shutdown
end
diff --git a/test/open-uri/test_ssl.rb b/test/open-uri/test_ssl.rb
index 31b93e0b13..dfa3283486 100644
--- a/test/open-uri/test_ssl.rb
+++ b/test/open-uri/test_ssl.rb
@@ -53,6 +53,7 @@ class TestOpenURISSL < Test::Unit::TestCase
with_https(nil) {|srv, dr, url, server_thread, server_log|
setup_validation(srv, dr)
assert_raise(OpenSSL::SSL::SSLError) { URI.open("#{url}/data") {} }
+ sleep 0.5 unless RUBY_PLATFORM =~ /mswin|mingw/
}
end
diff --git a/test/open-uri/utils.rb b/test/open-uri/utils.rb
index 076362b116..36d00e7932 100644
--- a/test/open-uri/utils.rb
+++ b/test/open-uri/utils.rb
@@ -363,6 +363,7 @@ module TestOpenURIUtils
}
begin
yield srv, dr, url, cacert_filename, cacert_directory, proxy_host, proxy_port
+ sleep 1
ensure
proxy.shutdown
end
diff --git a/test/rubygems/test_gem_remote_fetcher_local_ssl_server.rb b/test/rubygems/test_gem_remote_fetcher_local_ssl_server.rb
index 3770b356fa..679144d3b6 100644
--- a/test/rubygems/test_gem_remote_fetcher_local_ssl_server.rb
+++ b/test/rubygems/test_gem_remote_fetcher_local_ssl_server.rb
@@ -143,6 +143,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
end
fetcher = Gem::RemoteFetcher.new
yield fetcher
+ sleep 0.5 unless RUBY_PLATFORM =~ /mswin|mingw/
ensure
fetcher.close_all
Gem.configuration = nil