Project

General

Profile

Actions

Feature #14340

closed

[PATCH/RFC] exclude expensive MDNS test

Added by normalperson (Eric Wong) over 6 years ago. Updated over 6 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:84751]

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

Updated by znz (Kazuhiro NISHIYAMA) over 6 years ago

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

Updated by normalperson (Eric Wong) over 6 years ago

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

Updated by znz (Kazuhiro NISHIYAMA) over 6 years ago

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.

Actions #4

Updated by naruse (Yui NARUSE) over 6 years ago

  • 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.

Updated by normalperson (Eric Wong) over 6 years ago

Thank you naruse!

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0