summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPrabhu Das <prabhu.das@clogeny.com>2013-08-09 17:19:56 +0530
committeradamedx <adamed@opscode.com>2013-08-19 11:52:45 -0700
commitba5d01c5495e0f47a7a10de1cfa19f16974e2b68 (patch)
tree8b0f83b21023b43dc45a04df2c3f3527a3593f1f
parent4f3eb6ba9708a49dd1b7763b0a4be3b948d18aea (diff)
downloadohai-ba5d01c5495e0f47a7a10de1cfa19f16974e2b68.tar.gz
Added missing tests for netstat -nrf inet6.
-rw-r--r--spec/unit/plugins/aix/network_spec.rb55
1 files changed, 40 insertions, 15 deletions
diff --git a/spec/unit/plugins/aix/network_spec.rb b/spec/unit/plugins/aix/network_spec.rb
index d602575a..7df41feb 100644
--- a/spec/unit/plugins/aix/network_spec.rb
+++ b/spec/unit/plugins/aix/network_spec.rb
@@ -79,7 +79,8 @@ ARP_AN
@plugin.stub(:popen4).with("lsdev -Cc if").and_yield(nil, StringIO.new, StringIO.new(@lsdev_Cc_if), nil)
@plugin.stub(:popen4).with("ifconfig en0").and_yield(nil, StringIO.new, StringIO.new(@ifconfig_en0), nil)
@plugin.stub(:popen4).with("entstat -d en0 | grep \"Hardware Address\"").and_yield(nil, StringIO.new, StringIO.new("Hardware Address: be:42:80:00:b0:05"), nil)
- %w{inet inet6}.each { |i| @plugin.stub(:popen4).with("netstat -nrf #{i}").and_yield(nil, StringIO.new, StringIO.new(@netstat_nrf_inet), nil)}
+ @plugin.stub(:popen4).with("netstat -nrf inet").and_yield(nil, StringIO.new, StringIO.new(@netstat_nrf_inet), nil)
+ @plugin.stub(:popen4).with("netstat -nrf inet6").and_yield(nil, StringIO.new, StringIO.new("::1%1 ::1%1 UH 1 109392 en0 - -"), nil)
@plugin.stub(:popen4).with("arp -an").and_yield(nil, StringIO.new, StringIO.new(@aix_arp_an), nil)
end
@@ -203,25 +204,49 @@ ARP_AN
end
describe "netstat -nrf family" do
- before do
- @plugin.run
- end
+ context "inet" do
+ before do
+ @plugin.run
+ end
- it "detects the route destinations" do
- @plugin['network']['interfaces']['en0'][:routes][0][:destination].should == "default"
- @plugin['network']['interfaces']['en0'][:routes][1][:destination].should == "172.29.128.0"
- end
+ it "detects the route destinations" do
+ @plugin['network']['interfaces']['en0'][:routes][0][:destination].should == "default"
+ @plugin['network']['interfaces']['en0'][:routes][1][:destination].should == "172.29.128.0"
+ end
- it "detects the route family" do
- @plugin['network']['interfaces']['en0'][:routes][0][:family].should == "inet"
- end
+ it "detects the route family" do
+ @plugin['network']['interfaces']['en0'][:routes][0][:family].should == "inet"
+ end
+
+ it "detects the route gateway" do
+ @plugin['network']['interfaces']['en0'][:routes][0][:via].should == "172.29.128.13"
+ end
- it "detects the route gateway" do
- @plugin['network']['interfaces']['en0'][:routes][0][:via].should == "172.29.128.13"
+ it "detects the route flags" do
+ @plugin['network']['interfaces']['en0'][:routes][0][:flags].should == "UG"
+ end
end
- it "detects the route flags" do
- @plugin['network']['interfaces']['en0'][:routes][0][:flags].should == "UG"
+ context "inet6" do
+ before do
+ @plugin.run
+ end
+
+ it "detects the route destinations" do
+ @plugin['network']['interfaces']['en0'][:routes][4][:destination].should == "::1%1"
+ end
+
+ it "detects the route family" do
+ @plugin['network']['interfaces']['en0'][:routes][4][:family].should == "inet6"
+ end
+
+ it "detects the route gateway" do
+ @plugin['network']['interfaces']['en0'][:routes][4][:via].should == "::1%1"
+ end
+
+ it "detects the route flags" do
+ @plugin['network']['interfaces']['en0'][:routes][4][:flags].should == "UH"
+ end
end
end