From 2ceb0fbf6d44f982f1063f4dc058faebbe0a6ece Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Thu, 2 Apr 2015 11:44:40 +0100 Subject: [PATCH] Make sure link exists before proceeding with test --- test/t_route.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/t_route.rb b/test/t_route.rb index cc48948..e581f94 100644 --- a/test/t_route.rb +++ b/test/t_route.rb @@ -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 }