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

@@ -43,6 +43,9 @@ class TestAddr < Test::Unit::TestCase
test "massively parallel IP address addition" do
@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
@@ -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 }