summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThom May <thom@may.lt>2015-04-24 11:17:12 +0100
committerThom May <thom@may.lt>2015-04-24 11:17:12 +0100
commit0a2655b1ef473b9ee2c6766b949634cb9cd0dad8 (patch)
tree9e655ff25f04dec88359b0b1a521d3fadceee381
parent85235a85a004c66a3ae2ef40c1b46f93451bde8e (diff)
downloadohai-tm/avoid_v6.tar.gz
Ensure we test v6 correctlytm/avoid_v6
-rw-r--r--spec/unit/plugins/linux/network_spec.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/spec/unit/plugins/linux/network_spec.rb b/spec/unit/plugins/linux/network_spec.rb
index 1369b600..696a874e 100644
--- a/spec/unit/plugins/linux/network_spec.rb
+++ b/spec/unit/plugins/linux/network_spec.rb
@@ -314,7 +314,7 @@ fe80::21c:eff:fe12:3456 dev eth0.153 lladdr 00:1c:0e:30:28:00 router REACHABLE
end
describe "#iproute2_binary_available?" do
- ["/sbin/ip", "/usr/bin/ip"].each do |path|
+ ["/sbin/ip", "/usr/bin/ip", "/bin/ip"].each do |path|
it "accepts #{path}" do
allow(File).to receive(:exist?).and_return(false)
allow(File).to receive(:exist?).with(path).and_return(true)
@@ -546,6 +546,7 @@ Destination Gateway Genmask Flags Metric Ref Use Iface
describe "for newer network features using iproute2 only" do
before(:each) do
allow(File).to receive(:exist?).with("/sbin/ip").and_return(true) # iproute2 only
+ allow(File).to receive(:exist?).with("/proc/net/if_inet6").and_return(true) # ipv6 is enabled
plugin.run
end
@@ -591,6 +592,17 @@ Destination Gateway Genmask Flags Metric Ref Use Iface
expect(plugin['network']['interfaces']['eth3']['state']).to eq('up')
end
+ describe "when IPv6 is disabled" do
+ before :each do
+ allow(File).to receive(:exist?).with("/proc/net/if_inet6").and_return(false)
+ plugin.run
+ end
+
+ it "doesn't set ip6address" do
+ expect(plugin['ip6address']).to be_nil
+ end
+ end
+
describe "when dealing with routes" do
it "adds routes" do
plugin.run