summaryrefslogtreecommitdiff
path: root/test/resolv
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-29 00:06:17 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-29 00:06:17 +0000
commit089d2ddda44b5c7f7e1e6c69103b6f47716786d2 (patch)
tree0d62d53f9ccc0b760bb3a2291ef5c024ebff464d /test/resolv
parent2dce743725236e0bdfd99ed005bc6266a2c943b4 (diff)
* 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
Diffstat (limited to 'test/resolv')
-rw-r--r--test/resolv/test_dns.rb14
1 files changed, 14 insertions, 0 deletions
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