1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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"}>.
```
This commit is contained in:
Kazuhiro NISHIYAMA 2019-12-15 20:03:47 +09:00
parent 980ddca47e
commit a83c46e3fd
No known key found for this signature in database
GPG key ID: 262ED8DBB4222F7A

View file

@ -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