summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Nasrat <pnasrat@googlemail.com>2009-05-07 08:00:08 +0100
committerJames Turnbull <james@lovedthanlost.net>2009-05-13 16:17:59 +1000
commit2fb91caa311ea20f8342289050c367f30a610827 (patch)
tree266c0096ed06b47ac5e3a274a903f8c48d481a6e
parent00b192a727c3b3c573e103b78acaad2ba6215ac1 (diff)
downloadfacter-2fb91caa311ea20f8342289050c367f30a610827.tar.gz
facter-2fb91caa311ea20f8342289050c367f30a610827.tar.xz
facter-2fb91caa311ea20f8342289050c367f30a610827.zip
Tests for #2227 - multiple interfaces on Darwin
This seems to have been fixed functionally on master (in /Users/pnasrat/Development/facter/spec) Finished in 1.604955 seconds 183 examples, 0 failures However I want to take the opportunity to add tests to prevent regressions Paul
-rw-r--r--spec/unit/data/darwin_ifconfig_all_with_multiple_interfaces10
-rw-r--r--spec/unit/util/ip.rb6
2 files changed, 16 insertions, 0 deletions
diff --git a/spec/unit/data/darwin_ifconfig_all_with_multiple_interfaces b/spec/unit/data/darwin_ifconfig_all_with_multiple_interfaces
new file mode 100644
index 0000000..fb94751
--- /dev/null
+++ b/spec/unit/data/darwin_ifconfig_all_with_multiple_interfaces
@@ -0,0 +1,10 @@
+lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
+ inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
+ inet 127.0.0.1 netmask 0xff000000
+ inet6 ::1 prefixlen 128
+en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
+ inet6 fe80::223:6cff:fe99:602b%en1 prefixlen 64 scopeid 0x5
+ inet 192.168.0.10 netmask 0xffffff00 broadcast 192.168.0.255
+ ether 00:23:6c:99:60:2b
+ media: autoselect status: active
+ supported media: autoselect
diff --git a/spec/unit/util/ip.rb b/spec/unit/util/ip.rb
index 6290a30..512c07b 100644
--- a/spec/unit/util/ip.rb
+++ b/spec/unit/util/ip.rb
@@ -27,6 +27,12 @@ describe Facter::Util::IP do
Facter::Util::IP.get_interfaces().should == ["eth0"]
end
+ it "should return a list two interfaces on Darwin with two interfaces" do
+ sample_output_file = File.dirname(__FILE__) + '/../data/darwin_ifconfig_all_with_multiple_interfaces'
+ darwin_ifconfig = File.new(sample_output_file).read()
+ Facter::Util::IP.stubs(:get_all_interface_output).returns(darwin_ifconfig)
+ Facter::Util::IP.get_interfaces().should == ["lo0", "en0"]
+ end
it "should return a value for a specific interface" do
Facter::Util::IP.should respond_to(:get_interface_value)