summaryrefslogtreecommitdiff
path: root/test/net
diff options
context:
space:
mode:
authorKazuhiro NISHIYAMA <zn@mbf.nifty.com>2019-12-15 20:03:47 +0900
committerKazuhiro NISHIYAMA <zn@mbf.nifty.com>2019-12-15 20:09:24 +0900
commita83c46e3fd1e3480404c6dda4c4cda73533a6a1d (patch)
treef64a2dcee1dd4145a4edac3d05200b50edc0b687 /test/net
parent980ddca47e892535c1da897b33ac7bc727efd52d (diff)
Add more debug info
closed server doesn't have useful info. So call inspect before close. And add local debug code in comment. https://rubyci.org/logs/rubyci.s3.amazonaws.com/unstable11x/ruby-master/log/20191215T092405Z.fail.html.gz ``` 1) Failure: IMAPTest#test_connection_closed_without_greeting [/export/home/rubyci/chkbuild-tmp/tmp/build/20191215T092405Z/ruby/test/net/imap/test_imap.rb:483]: [Net::IMAP::Error] exception expected, not #<RuntimeError: {:e=>#<Errno::EINVAL: Invalid argument - connect(2) for [::1]:41748>, :server=>#<TCPServer:(closed)>, :port=>41748, :server_addr=>"::1"}>. ```
Diffstat (limited to 'test/net')
-rw-r--r--test/net/imap/test_imap.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/net/imap/test_imap.rb b/test/net/imap/test_imap.rb
index 850974f..33b305e 100644
--- a/test/net/imap/test_imap.rb
+++ b/test/net/imap/test_imap.rb
@@ -472,18 +472,25 @@ class IMAPTest < Test::Unit::TestCase
def test_connection_closed_without_greeting
server = create_tcp_server
port = server.addr[1]
+ h = {'server before close': server.inspect} # inspect info before close
start_server do
begin
sock = server.accept
+ h[:sock_addr], h[:sock_peeraddr] = sock.addr, sock.peeraddr
sock.close
ensure
server.close
end
end
assert_raise(Net::IMAP::Error) do
+ #begin
Net::IMAP.new(server_addr, :port => port)
+ #rescue Net::IMAP::Error
+ # raise Errno::EINVAL
+ #end
rescue Errno::EINVAL => e # for debug on OpenCSW
- raise({e: e, server: server, port: port, server_addr: server_addr}.inspect)
+ h.merge!({e: e, server: server, port: port, server_addr: server_addr})
+ raise(h.inspect)
end
end