From 089d2ddda44b5c7f7e1e6c69103b6f47716786d2 Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 29 May 2010 00:06:17 +0000 Subject: * lib/resolv.rb (Resolv::DNS::Requester#request): rescue ECONNREFUSED. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/resolv/test_dns.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/resolv/test_dns.rb') diff --git a/test/resolv/test_dns.rb b/test/resolv/test_dns.rb index 0ab59665a3..9a9c33ea84 100644 --- a/test/resolv/test_dns.rb +++ b/test/resolv/test_dns.rb @@ -104,4 +104,18 @@ class TestResolvDNS < Test::Unit::TestCase end } end + + def test_no_server + u = UDPSocket.new + u.bind("127.0.0.1", 0) + _, port, _, host = u.addr + u.close + # A rase condition here. + # Another program may use the port. + # But no way to prevent it. + Resolv::DNS.open(:nameserver_port => [[host, port]]) {|dns| + assert_equal([], dns.getresources("test-no-server.example.org", Resolv::DNS::Resource::IN::A)) + } + end + end -- cgit v1.2.3