Feature #14340 closed
[PATCH/RFC] exclude expensive MDNS test
Added by normalperson (Eric Wong) over 7 years ago.
Updated over 7 years ago.
Description
test/excludes: exclude expensive MDNS resolv test
This test takes around 80s on my Debian GNU/Linux systems, not
sure if there's a misconfiguration on my part or a bug
somewhere. Other opinions wanted (I am not knowledgeable with
MDNS stuff at all)
test/excludes/TestResolvMDNS.rb: new exclude
Files
How about adding timeouts instead of excluding?
require 'resolv'
mdns = Resolv :: MDNS . new
mdns . timeouts = 1.0
mdns . each_resource '_http._tcp.local' , Resolv :: DNS :: Resource :: IN :: PTR do | r |
srv = mdns . getresource r . name , Resolv :: DNS :: Resource :: IN :: SRV
mdns . each_address ( srv . target ) do | result |
p ( result )
end
end
zn@mbf.nifty.com wrote:
How about adding timeouts instead of excluding?
require 'resolv'
mdns = Resolv :: MDNS . new
mdns . timeouts = 1.0
mdns . each_resource '_http._tcp.local' , Resolv :: DNS :: Resource :: IN :: PTR do | r |
srv = mdns . getresource r . name , Resolv :: DNS :: Resource :: IN :: SRV
mdns . each_address ( srv . target ) do | result |
p ( result )
I get no results with that; so the assert_not_nil won't be reached
https://bugs.ruby-lang.org/issues/14340#change-69480
I get no results on my mac too.
So I think it is expected behavior in network without requested resources.
% time ruby test.rb
real:0.20s user:0.13s sys:0.03s cpu:80% mem:0+0k 0pf+0w IO:0+0 ruby test.rb
And I get a result on another network.
% time ruby test.rb
#<Resolv::IPv4 192.168.zzz.www>
real:0.39s user:0.14s sys:0.08s cpu:55% mem:0+0k 216pf+0w IO:38+0 ruby test.rb
Both returns <0.5s, so I think timeouts=1.0s is enough.
Status changed from Open to Closed
Applied in changeset trunk|r61774.
Mock fetching data from real DNS [Feature #14340 ]
This test just tests MDNS#each_address method.
Also available in: Atom
PDF
Like 0
Like 0 Like 0 Like 0 Like 0 Like 0