зеркало из https://github.com/github/ruby.git
Fix Resolv specs to not depend on a system /etc/hosts file
* https://rubyci.org/logs/rubyci.s3.amazonaws.com/archlinux/ruby-master/log/20190609T153804Z.fail.html.gz * Thanks @naruse for the tip.
This commit is contained in:
Родитель
614154bbb6
Коммит
60af6fef3c
|
@ -0,0 +1 @@
|
|||
127.0.0.1 localhost localhost4
|
|
@ -4,11 +4,11 @@ require 'resolv'
|
|||
describe "Resolv#getaddress" do
|
||||
platform_is_not :windows do
|
||||
it "resolves localhost" do
|
||||
res = Resolv.new([Resolv::Hosts.new])
|
||||
hosts = Resolv::Hosts.new(fixture(__FILE__ , "hosts"))
|
||||
res = Resolv.new([hosts])
|
||||
|
||||
lambda {
|
||||
res.getaddress("localhost")
|
||||
}.should_not raise_error(Resolv::ResolvError)
|
||||
res.getaddress("localhost").should == "127.0.0.1"
|
||||
res.getaddress("localhost4").should == "127.0.0.1"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -4,11 +4,11 @@ require 'resolv'
|
|||
describe "Resolv#getaddresses" do
|
||||
platform_is_not :windows do
|
||||
it "resolves localhost" do
|
||||
res = Resolv.new([Resolv::Hosts.new])
|
||||
hosts = Resolv::Hosts.new(fixture(__FILE__ , "hosts"))
|
||||
res = Resolv.new([hosts])
|
||||
|
||||
addresses = res.getaddresses("localhost")
|
||||
addresses.should_not == nil
|
||||
addresses.size.should > 0
|
||||
res.getaddresses("localhost").should == ["127.0.0.1"]
|
||||
res.getaddresses("localhost4").should == ["127.0.0.1"]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,9 +4,10 @@ require 'resolv'
|
|||
describe "Resolv#getname" do
|
||||
platform_is_not :windows do
|
||||
it "resolves 127.0.0.1" do
|
||||
lambda {
|
||||
Resolv.getname("127.0.0.1")
|
||||
}.should_not raise_error(Resolv::ResolvError)
|
||||
hosts = Resolv::Hosts.new(fixture(__FILE__ , "hosts"))
|
||||
res = Resolv.new([hosts])
|
||||
|
||||
res.getname("127.0.0.1").should == "localhost"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -4,11 +4,10 @@ require 'resolv'
|
|||
describe "Resolv#getnames" do
|
||||
platform_is_not :windows do
|
||||
it "resolves 127.0.0.1" do
|
||||
res = Resolv.new([Resolv::Hosts.new])
|
||||
hosts = Resolv::Hosts.new(fixture(__FILE__ , "hosts"))
|
||||
res = Resolv.new([hosts])
|
||||
|
||||
names = res.getnames("127.0.0.1")
|
||||
names.should_not == nil
|
||||
names.size.should > 0
|
||||
names = res.getnames("127.0.0.1").should == ["localhost", "localhost4"]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче