summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan McLellan <btm@chef.io>2016-01-02 20:48:13 -0800
committerBryan McLellan <btm@chef.io>2016-01-02 20:48:13 -0800
commit920054afc670cf8f7cb09cf368c043136ca1fe98 (patch)
tree4d18b2bf9903f30e901431b98bf984733f7b93fb
parent3acc58eade5abcadab414e4f0ca84c37d14285e1 (diff)
downloadohai-920054afc670cf8f7cb09cf368c043136ca1fe98.tar.gz
fix remaining tests
-rw-r--r--lib/ohai/plugins/network.rb2
-rw-r--r--spec/unit/plugins/network_spec.rb19
2 files changed, 11 insertions, 10 deletions
diff --git a/lib/ohai/plugins/network.rb b/lib/ohai/plugins/network.rb
index ef79b837..ac55f1b0 100644
--- a/lib/ohai/plugins/network.rb
+++ b/lib/ohai/plugins/network.rb
@@ -165,7 +165,7 @@ Ohai.plugin(:NetworkAddresses) do
# otherwise we set macaddress on a first-found basis (and we started with ipv4)
if macaddress.nil?
if r["mac"]
- Ohai::Log.debug("setting macaddress from interface '#{r["iface"]}' for family '#{family}'")
+ Ohai::Log.debug("setting macaddress to '#{r["mac"]}' from interface '#{r["iface"]}' for family '#{family}'")
macaddress r["mac"]
else
Ohai::Log.debug("unable to detect macaddress for family '#{family}'")
diff --git a/spec/unit/plugins/network_spec.rb b/spec/unit/plugins/network_spec.rb
index 3aa0dbe2..5b426334 100644
--- a/spec/unit/plugins/network_spec.rb
+++ b/spec/unit/plugins/network_spec.rb
@@ -202,7 +202,9 @@ describe Ohai::System, "Network Plugin" do
}
},
"default_gateway" => "76.91.0.1",
- "default_interface" => "vr0"
+ "default_interface" => "vr0",
+ "default_inet6_gateway" => "2001:470:d:cb4::2",
+ "default_inet6_interface" => "bridge0"
}
},
"linux" => {
@@ -419,10 +421,9 @@ describe Ohai::System, "Network Plugin" do
end
it "warns about this conflict" do
- pending("this test doesnt set default_gateway, cannot tell how it conflicts with default_interface")
-
expect(Ohai::Log).to receive(:debug).with(/^\[inet\] no ipaddress\/mask on eth1/).once
expect(Ohai::Log).to receive(:debug).with(/^\[inet6\] no ipaddress\/mask on eth1/).once
+ allow(Ohai::Log).to receive(:debug)
@plugin.run
end
end
@@ -796,7 +797,7 @@ describe Ohai::System, "Network Plugin" do
it "warns about not being able to set {ip,mac}address (ipv4)" do
expect(Ohai::Log).to receive(:warn).with(/^unable to detect ipaddress/).once
expect(Ohai::Log).to receive(:debug).with(/^unable to detect macaddress/) # for ipv4
- expect(Ohai::Log).to receive(:debug).with(/^setting macaddress from interface 'eth0' for family 'inet6'/) # for ipv6
+ expect(Ohai::Log).to receive(:debug).with(/^setting macaddress to/) # for ipv6
expect(Ohai::Log).to receive(:debug).with(/^\[inet6\] Using default interface eth0 and default gateway/) # for ipv6
@plugin.run
end
@@ -809,7 +810,7 @@ describe Ohai::System, "Network Plugin" do
end
it "informs about macaddress being set using the ipv6 setup" do
- expect(Ohai::Log).to receive(:debug).with(/^macaddress set to 00:16:3E:2F:36:79 from the ipv6 setup/).once
+ expect(Ohai::Log).to receive(:debug).with(/^setting macaddress to '00:16:3E:2F:36:79'/)
allow(Ohai::Log).to receive(:debug)
@plugin.run
end
@@ -841,7 +842,7 @@ describe Ohai::System, "Network Plugin" do
end
it "informs about macaddress being set using the ipv6 setup" do
- expect(Ohai::Log).to receive(:debug).with(/^macaddress set to 00:16:3E:2F:36:79 from the ipv6 setup/).once
+ expect(Ohai::Log).to receive(:debug).with(/^setting macaddress to '00:16:3E:2F:36:79'/)
allow(Ohai::Log).to receive(:debug)
@plugin.run
end
@@ -861,8 +862,8 @@ describe Ohai::System, "Network Plugin" do
@plugin["macaddress"] = "00:AA:BB:CC:DD:EE"
@expected_results = {
"freebsd" => {
- "ip6address" => "::1",
- "macaddress" => "00:16:3E:2F:36:79"
+ "ip6address" => "2001:470:d:cb4::1",
+ "macaddress" => "02:20:6f:d2:c4:00"
},
"linux" => {
"ip6address" => "3ffe:1111:2222::33",
@@ -935,7 +936,7 @@ describe Ohai::System, "Network Plugin" do
@plugin["ip6address"] = "3ffe:8888:9999::1"
@expected_results = {
"freebsd" => {
- "macaddress" => "00:16:3E:2F:36:79"
+ "macaddress" => "02:20:6f:d2:c4:00"
},
"linux" => {
"macaddress" => "00:16:3E:2F:36:79"