Make sure link exists before proceeding with test

This commit is contained in:
Patrick J Cherry
2015-04-02 11:44:40 +01:00
parent 51b8bbcd8a
commit 2ceb0fbf6d

View File

@@ -44,6 +44,9 @@ class TestAddr < Test::Unit::TestCase
@ifname = create_test_interface
return if @ifname.nil?
link = @ip.link.list.find{|x| x.ifname == @ifname}
return if link.nil?
ips = (10..20).map {|y| (1..254).map {|z| "10.100.#{y}.#{z}" } }.flatten.compact
threads = ips.map {|ip|
@@ -57,6 +60,7 @@ class TestAddr < Test::Unit::TestCase
}
threads.map{|t| t.join }
created = @ip.addr.list(:index => @ifname, :family => Socket::AF_INET).
map {|ifaddr| ifaddr.address.to_s }