summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorClaire McQuin <clairemcquin@seamcquin100loaner.local>2014-01-12 16:22:06 -0800
committerClaire McQuin <clairemcquin@seamcquin100loaner.local>2014-01-12 16:22:06 -0800
commitced089e2c8fef4ff26b44fe2a2989812a514893d (patch)
treef769e4f435efb666392db56721980d0ab4c84030 /spec
parentc396684c8d795c1662e45eea46b5de004fba76a6 (diff)
downloadohai-ced089e2c8fef4ff26b44fe2a2989812a514893d.tar.gz
convert aix unit tests to version 7 test format
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/plugins/aix/cpu_spec.rb35
-rw-r--r--spec/unit/plugins/aix/filesystem_spec.rb36
-rw-r--r--spec/unit/plugins/aix/hostname_spec.rb12
-rw-r--r--spec/unit/plugins/aix/kernel_spec.rb25
-rw-r--r--spec/unit/plugins/aix/network_spec.rb111
-rw-r--r--spec/unit/plugins/aix/platform_spec.rb21
-rw-r--r--spec/unit/plugins/aix/uptime_spec.rb15
7 files changed, 140 insertions, 115 deletions
diff --git a/spec/unit/plugins/aix/cpu_spec.rb b/spec/unit/plugins/aix/cpu_spec.rb
index 7e4b1977..d47e87ea 100644
--- a/spec/unit/plugins/aix/cpu_spec.rb
+++ b/spec/unit/plugins/aix/cpu_spec.rb
@@ -31,51 +31,50 @@ smt_threads 2 Processor SMT threads False
state enable Processor state False
type PowerPC_POWER5 Processor type False
LSATTR_EL
- @ohai = Ohai::System.new
- @ohai.stub!(:require_plugin).and_return(true)
- @ohai[:os] = "aix"
+ @plugin = get_plugin("aix/cpu")
+ @plugin.stub(:collect_os).and_return(:aix)
- @ohai.stub(:from).with("lsdev -Cc processor").and_return(@lsdev_Cc_processor)
- @ohai.stub(:from).with("lsattr -El proc0").and_return(@lsattr_El_proc0)
- @ohai._require_plugin("aix::cpu")
+ @plugin.stub(:from).with("lsdev -Cc processor").and_return(@lsdev_Cc_processor)
+ @plugin.stub(:from).with("lsattr -El proc0").and_return(@lsattr_El_proc0)
+ @plugin.run
end
it "sets the vendor id to IBM" do
- @ohai[:cpu][:vendor_id].should == "IBM"
+ @plugin[:cpu][:vendor_id].should == "IBM"
end
it "sets the available attribute" do
- @ohai[:cpu][:available].should == 1
+ @plugin[:cpu][:available].should == 1
end
it "sets the total number of devices" do
- @ohai[:cpu][:total].should == 2
+ @plugin[:cpu][:total].should == 2
end
it "detects the model" do
- @ohai[:cpu][:model].should == "PowerPC_POWER5"
+ @plugin[:cpu][:model].should == "PowerPC_POWER5"
end
it "detects the mhz" do
- @ohai[:cpu][:mhz].should == 1615570
+ @plugin[:cpu][:mhz].should == 1615570
end
it "detects the status of the device" do
- @ohai[:cpu][:proc0][:status].should == "Available"
+ @plugin[:cpu][:proc0][:status].should == "Available"
end
it "detects the location of the device" do
- @ohai[:cpu][:proc0][:location].should == "00-00"
+ @plugin[:cpu][:proc0][:location].should == "00-00"
end
context "lsattr -El device_name" do
it "detects all the attributes of the device" do
- @ohai[:cpu][:proc0][:frequency].should == "1654344000"
- @ohai[:cpu][:proc0][:smt_enabled].should == "true"
- @ohai[:cpu][:proc0][:smt_threads].should == "2"
- @ohai[:cpu][:proc0][:state].should == "enable"
- @ohai[:cpu][:proc0][:type].should == "PowerPC_POWER5"
+ @plugin[:cpu][:proc0][:frequency].should == "1654344000"
+ @plugin[:cpu][:proc0][:smt_enabled].should == "true"
+ @plugin[:cpu][:proc0][:smt_threads].should == "2"
+ @plugin[:cpu][:proc0][:state].should == "enable"
+ @plugin[:cpu][:proc0][:type].should == "PowerPC_POWER5"
end
end
end
diff --git a/spec/unit/plugins/aix/filesystem_spec.rb b/spec/unit/plugins/aix/filesystem_spec.rb
index 4f87712d..4c903787 100644
--- a/spec/unit/plugins/aix/filesystem_spec.rb
+++ b/spec/unit/plugins/aix/filesystem_spec.rb
@@ -45,66 +45,66 @@ DF_P
192.168.1.11 /stage/middleware /stage/middleware nfs3 Jul 17 13:24 ro,bg,hard,intr,sec=sys
MOUNT
- @ohai = Ohai::System.new
- @ohai.stub(:require_plugin).and_return(true)
- @ohai[:filesystem] = Mash.new
- @ohai.stub(:popen4).with("df -P").and_yield(nil, StringIO.new, StringIO.new(@df_P), nil)
- @ohai.stub(:popen4).with("mount").and_yield(nil, StringIO.new, StringIO.new(@mount), nil)
- @ohai._require_plugin("aix::filesystem")
+ @plugin = get_plugin("aix/filesystem")
+ @plugin.stub(:collect_os).and_return(:aix)
+ @plugin[:filesystem] = Mash.new
+ @plugin.stub(:popen4).with("df -P").and_yield(nil, StringIO.new, StringIO.new(@df_P), nil)
+ @plugin.stub(:popen4).with("mount").and_yield(nil, StringIO.new, StringIO.new(@mount), nil)
+ @plugin.run
end
describe "df -P" do
it "returns the filesystem block size" do
- @ohai[:filesystem]["/dev/hd4"]['kb_size'].should == "786432"
+ @plugin[:filesystem]["/dev/hd4"]['kb_size'].should == "786432"
end
it "returns the filesystem used space in kb" do
- @ohai[:filesystem]["/dev/hd4"]['kb_used'].should == "495632"
+ @plugin[:filesystem]["/dev/hd4"]['kb_used'].should == "495632"
end
it "returns the filesystem available space in kb" do
- @ohai[:filesystem]["/dev/hd4"]['kb_available'].should == "290800"
+ @plugin[:filesystem]["/dev/hd4"]['kb_available'].should == "290800"
end
it "returns the filesystem capacity in percentage" do
- @ohai[:filesystem]["/dev/hd4"]['percent_used'].should == "64%"
+ @plugin[:filesystem]["/dev/hd4"]['percent_used'].should == "64%"
end
it "returns the filesystem mounted location" do
- @ohai[:filesystem]["/dev/hd4"]['mount'].should == "/"
+ @plugin[:filesystem]["/dev/hd4"]['mount'].should == "/"
end
end
describe "mount" do
it "returns the filesystem mount location" do
- @ohai[:filesystem]["/dev/hd4"]['mount'].should == "/"
+ @plugin[:filesystem]["/dev/hd4"]['mount'].should == "/"
end
it "returns the filesystem type" do
- @ohai[:filesystem]["/dev/hd4"]['fs_type'].should == "jfs2"
+ @plugin[:filesystem]["/dev/hd4"]['fs_type'].should == "jfs2"
end
it "returns the filesystem mount options" do
- @ohai[:filesystem]["/dev/hd4"]['mount_options'].should == "rw,log=/dev/hd8"
+ @plugin[:filesystem]["/dev/hd4"]['mount_options'].should == "rw,log=/dev/hd8"
end
# For entries like 192.168.1.11 /stage/middleware /stage/middleware nfs3 Jul 17 13:24 ro,bg,hard,intr,sec=sys
context "having node values" do
before do
- @ohai.stub(:popen4).with("mount").and_yield(nil, StringIO.new, StringIO.new("192.168.1.11 /stage/middleware /stage/middleware nfs3 Jul 17 13:24 ro,bg,hard,intr,sec=sys"), nil)
+ @plugin.stub(:popen4).with("mount").and_yield(nil, StringIO.new, StringIO.new("192.168.1.11 /stage/middleware /stage/middleware nfs3 Jul 17 13:24 ro,bg,hard,intr,sec=sys"), nil)
end
it "returns the filesystem mount location" do
- @ohai[:filesystem]["192.168.1.11:/stage/middleware"]['mount'].should == "/stage/middleware"
+ @plugin[:filesystem]["192.168.1.11:/stage/middleware"]['mount'].should == "/stage/middleware"
end
it "returns the filesystem type" do
- @ohai[:filesystem]["192.168.1.11:/stage/middleware"]['fs_type'].should == "nfs3"
+ @plugin[:filesystem]["192.168.1.11:/stage/middleware"]['fs_type'].should == "nfs3"
end
it "returns the filesystem mount options" do
- @ohai[:filesystem]["192.168.1.11:/stage/middleware"]['mount_options'].should == "ro,bg,hard,intr,sec=sys"
+ @plugin[:filesystem]["192.168.1.11:/stage/middleware"]['mount_options'].should == "ro,bg,hard,intr,sec=sys"
end
end
end
diff --git a/spec/unit/plugins/aix/hostname_spec.rb b/spec/unit/plugins/aix/hostname_spec.rb
index 13eadd8a..4406ce5b 100644
--- a/spec/unit/plugins/aix/hostname_spec.rb
+++ b/spec/unit/plugins/aix/hostname_spec.rb
@@ -19,10 +19,14 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
describe Ohai::System, "Aix hostname plugin" do
before(:each) do
- @ohai = Ohai::System.new
- @ohai.stub(:from).with("hostname").and_return("aix_admin")
- @ohai._require_plugin("aix::hostname")
+ @plugin = get_plugin("hostname")
+ @plugin.stub(:collect_os).and_return(:aix)
+ @plugin.stub(:from_cmd).with("hostname").and_return("aix_admin")
+ @plugin.run
end
- it_should_check_from("aix::hostname", "hostname", "hostname", "aix_admin")
+ it "should set the machinename" do
+ @plugin[:machinename].should eql("aix_admin")
+ end
end
+
diff --git a/spec/unit/plugins/aix/kernel_spec.rb b/spec/unit/plugins/aix/kernel_spec.rb
index 85321402..89173a6b 100644
--- a/spec/unit/plugins/aix/kernel_spec.rb
+++ b/spec/unit/plugins/aix/kernel_spec.rb
@@ -19,33 +19,34 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
describe Ohai::System, "AIX kernel plugin" do
before(:each) do
- @ohai = Ohai::System.new
- @ohai.stub(:from).with("uname -s").and_return("AIX")
- @ohai.stub(:from).with("uname -r").and_return(1)
- @ohai.stub(:from).with("uname -v").and_return(6)
- @ohai.stub(:from).with("uname -p").and_return("powerpc")
+ @plugin = get_plugin("aix/kernel")
+ @plugin.stub(:collect_os).and_return(:aix)
+ @plugin.stub(:from).with("uname -s").and_return("AIX")
+ @plugin.stub(:from).with("uname -r").and_return(1)
+ @plugin.stub(:from).with("uname -v").and_return(6)
+ @plugin.stub(:from).with("uname -p").and_return("powerpc")
@modules = Mash.new
- @ohai[:kernel].stub(:modules).and_return(@modules)
- @ohai._require_plugin("aix::kernel")
+ @plugin.stub(:modules).and_return(@modules)
+ @plugin.run
end
it "uname -s detects the name" do
- @ohai[:kernel][:name].should == "aix"
+ @plugin[:kernel][:name].should == "aix"
end
it "uname -r detects the release" do
- @ohai[:kernel][:release].should == 1
+ @plugin[:kernel][:release].should == 1
end
it "uname -v detects the version" do
- @ohai[:kernel][:version].should == 6
+ @plugin[:kernel][:version].should == 6
end
it "uname -p detects the machine" do
- @ohai[:kernel][:machine].should == "powerpc"
+ @plugin[:kernel][:machine].should == "powerpc"
end
it "detects the modules" do
- @ohai[:kernel][:modules].should == @modules
+ @plugin[:kernel][:modules].should == @modules
end
end
diff --git a/spec/unit/plugins/aix/network_spec.rb b/spec/unit/plugins/aix/network_spec.rb
index b2147576..f6806992 100644
--- a/spec/unit/plugins/aix/network_spec.rb
+++ b/spec/unit/plugins/aix/network_spec.rb
@@ -71,68 +71,78 @@ bucket: 0 contains: 0 entries
There are 6 entries in the arp table.
ARP_AN
- @ohai = Ohai::System.new
- @ohai.stub(:require_plugin).and_return(true)
- @ohai[:network] = Mash.new
- @ohai.stub(:popen4).with("route -n get 0").and_yield(nil, StringIO.new, StringIO.new(@route_n_get_0), nil)
- @ohai.stub(:popen4).with("lsdev -Cc if").and_yield(nil, StringIO.new, StringIO.new(@lsdev_Cc_if), nil)
- @ohai.stub(:popen4).with("ifconfig en0").and_yield(nil, StringIO.new, StringIO.new(@ifconfig_en0), nil)
- @ohai.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)
- @ohai.stub(:popen4).with("netstat -nrf inet").and_yield(nil, StringIO.new, StringIO.new(@netstat_nrf_inet), nil)
- @ohai.stub(:popen4).with("netstat -nrf inet6").and_yield(nil, StringIO.new, StringIO.new("::1%1 ::1%1 UH 1 109392 en0 - -"), nil)
- @ohai.stub(:popen4).with("arp -an").and_yield(nil, StringIO.new, StringIO.new(@aix_arp_an), nil)
- @ohai._require_plugin("aix::network")
+ @plugin = get_plugin("aix/network")
+ @plugin.stub(:collect_os).and_return(:aix)
+ @plugin[:network] = Mash.new
+ @plugin.stub(:popen4).with("route -n get 0").and_yield(nil, StringIO.new, StringIO.new(@route_n_get_0), nil)
+ @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)
+ @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
describe "run" do
+ before do
+ @plugin.run
+ end
it "detects network information" do
- @ohai['network'].should_not be_nil
+ @plugin['network'].should_not be_nil
end
it "detects the interfaces" do
- @ohai['network']['interfaces'].keys.sort.should == ["en0"]
+ @plugin['network']['interfaces'].keys.sort.should == ["en0"]
end
it "detects the ip addresses of the interfaces" do
- @ohai['network']['interfaces']['en0']['addresses'].keys.should include('172.29.174.58')
+ @plugin['network']['interfaces']['en0']['addresses'].keys.should include('172.29.174.58')
end
end
describe "route -n get 0" do
+ before do
+ @plugin.run
+ end
it "returns the default gateway of the system's network" do
- @ohai[:network][:default_gateway].should == '172.29.128.13'
+ @plugin[:network][:default_gateway].should == '172.29.128.13'
end
it "returns the default interface of the system's network" do
- @ohai[:network][:default_interface].should == 'en0'
+ @plugin[:network][:default_interface].should == 'en0'
end
end
describe "lsdev -Cc if" do
-
it "detects the state of the interfaces in the system" do
- @ohai['network']['interfaces']['en0'][:state].should == "up"
+ @plugin.run
+ @plugin['network']['interfaces']['en0'][:state].should == "up"
end
it "detects the description of the interfaces in the system" do
- @ohai['network']['interfaces']['en0'][:description].should == "Standard Ethernet Network Interface"
+ @plugin.run
+ @plugin['network']['interfaces']['en0'][:description].should == "Standard Ethernet Network Interface"
end
describe "ifconfig interface" do
it "detects the CHAIN network flag" do
- @ohai['network']['interfaces']['en0'][:flags].should include('CHAIN')
+ @plugin.run
+ @plugin['network']['interfaces']['en0'][:flags].should include('CHAIN')
end
it "detects the metric network flag" do
- @ohai['network']['interfaces']['en0'][:metric].should == '1'
+ @plugin.run
+ @plugin['network']['interfaces']['en0'][:metric].should == '1'
end
context "inet entries" do
before do
- @inet_entry = @ohai['network']['interfaces']['en0'][:addresses]["172.29.174.58"]
+ @plugin.run
+ @inet_entry = @plugin['network']['interfaces']['en0'][:addresses]["172.29.174.58"]
end
+
it "detects the family" do
@inet_entry[:family].should == 'inet'
end
@@ -146,23 +156,24 @@ ARP_AN
end
it "detects all key-values" do
- @ohai['network']['interfaces']['en0'][:tcp_sendspace].should == "262144"
- @ohai['network']['interfaces']['en0'][:tcp_recvspace].should == "262144"
- @ohai['network']['interfaces']['en0'][:rfc1323].should == "1"
+ @plugin['network']['interfaces']['en0'][:tcp_sendspace].should == "262144"
+ @plugin['network']['interfaces']['en0'][:tcp_recvspace].should == "262144"
+ @plugin['network']['interfaces']['en0'][:rfc1323].should == "1"
end
# For an output with no netmask like inet 172.29.174.59 broadcast 172.29.191.255
context "with no netmask in the output" do
before do
- @inet_entry = @ohai['network']['interfaces']['en0'][:addresses]["172.29.174.59"]
- @ohai.stub(:popen4).with("ifconfig en0").and_yield(nil, StringIO.new, StringIO.new("inet 172.29.174.59 broadcast 172.29.191.255"), nil)
+ @plugin.stub(:popen4).with("ifconfig en0").and_yield(nil, StringIO.new, StringIO.new("inet 172.29.174.59 broadcast 172.29.191.255"), nil)
end
it "detects the default prefixlen" do
+ @inet_entry = @plugin['network']['interfaces']['en0'][:addresses]["172.29.174.59"]
@inet_entry[:prefixlen].should == '32'
end
it "detects the default netmask" do
+ @inet_entry = @plugin['network']['interfaces']['en0'][:addresses]["172.29.174.59"]
@inet_entry[:netmask].should == '255.255.255.255'
end
end
@@ -170,8 +181,9 @@ ARP_AN
context "inet6 entries" do
before do
- @inet_entry = @ohai['network']['interfaces']['en0'][:addresses]["::1%1"]
- @ohai.stub(:popen4).with("ifconfig en0").and_yield(nil, StringIO.new, StringIO.new("inet6 ::1%1/0"), nil)
+ @plugin.stub(:popen4).with("ifconfig en0").and_yield(nil, StringIO.new, StringIO.new("inet6 ::1%1/0"), nil)
+ @plugin.run
+ @inet_entry = @plugin['network']['interfaces']['en0'][:addresses]["::1%1"]
end
it "detects the prefixlen" do
@@ -186,7 +198,8 @@ ARP_AN
context "entstat -d interface" do
before do
- @inet_interface_addresses = @ohai['network']['interfaces']['en0'][:addresses]["BE:42:80:00:B0:05"]
+ @plugin.run
+ @inet_interface_addresses = @plugin['network']['interfaces']['en0'][:addresses]["BE:42:80:00:B0:05"]
end
it "detects the family" do
@inet_interface_addresses[:family].should == 'lladdr'
@@ -195,64 +208,72 @@ ARP_AN
end
describe "netstat -nrf family" do
- context "inet" do
+ before do
+ @plugin.run
+ end
+ context "inet" do
it "detects the route destinations" do
- @ohai['network']['interfaces']['en0'][:routes][0][:destination].should == "default"
- @ohai['network']['interfaces']['en0'][:routes][1][:destination].should == "172.29.128.0"
+ @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
- @ohai['network']['interfaces']['en0'][:routes][0][:family].should == "inet"
+ @plugin['network']['interfaces']['en0'][:routes][0][:family].should == "inet"
end
it "detects the route gateway" do
- @ohai['network']['interfaces']['en0'][:routes][0][:via].should == "172.29.128.13"
+ @plugin['network']['interfaces']['en0'][:routes][0][:via].should == "172.29.128.13"
end
it "detects the route flags" do
- @ohai['network']['interfaces']['en0'][:routes][0][:flags].should == "UG"
+ @plugin['network']['interfaces']['en0'][:routes][0][:flags].should == "UG"
end
end
context "inet6" do
it "detects the route destinations" do
- @ohai['network']['interfaces']['en0'][:routes][4][:destination].should == "::1%1"
+ @plugin['network']['interfaces']['en0'][:routes][4][:destination].should == "::1%1"
end
it "detects the route family" do
- @ohai['network']['interfaces']['en0'][:routes][4][:family].should == "inet6"
+ @plugin['network']['interfaces']['en0'][:routes][4][:family].should == "inet6"
end
it "detects the route gateway" do
- @ohai['network']['interfaces']['en0'][:routes][4][:via].should == "::1%1"
+ @plugin['network']['interfaces']['en0'][:routes][4][:via].should == "::1%1"
end
it "detects the route flags" do
- @ohai['network']['interfaces']['en0'][:routes][4][:flags].should == "UH"
+ @plugin['network']['interfaces']['en0'][:routes][4][:flags].should == "UH"
end
end
end
describe "arp -an" do
-
+ before do
+ @plugin.run
+ end
it "supresses the hostname entries" do
- @ohai['network']['arp'][0][:remote_host].should == "?"
+ @plugin['network']['arp'][0][:remote_host].should == "?"
end
it "detects the remote ip entry" do
- @ohai['network']['arp'][0][:remote_ip].should == "172.29.131.16"
+ @plugin['network']['arp'][0][:remote_ip].should == "172.29.131.16"
end
it "detects the remote mac entry" do
- @ohai['network']['arp'][0][:remote_mac].should == "6e:87:70:0:40:3"
+ @plugin['network']['arp'][0][:remote_mac].should == "6e:87:70:0:40:3"
end
end
describe "hex_to_dec_netmask method" do
+ before do
+ @plugin.run
+ end
it "converts a netmask from hexadecimal form to decimal form" do
- @ohai.hex_to_dec_netmask('0xffff0000').should == "255.255.0.0"
+ @plugin.hex_to_dec_netmask('0xffff0000').should == "255.255.0.0"
end
end
end
diff --git a/spec/unit/plugins/aix/platform_spec.rb b/spec/unit/plugins/aix/platform_spec.rb
index e7f70bdb..e2797090 100644
--- a/spec/unit/plugins/aix/platform_spec.rb
+++ b/spec/unit/plugins/aix/platform_spec.rb
@@ -19,24 +19,25 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
describe Ohai::System, "Aix plugin platform" do
before(:each) do
- @ohai = Ohai::System.new
- @ohai[:kernel] = Mash.new
- @ohai[:kernel][:name] = "aix"
- @ohai[:kernel][:version] = "1"
- @ohai[:kernel][:release] = "0"
- @ohai.stub(:require_plugin).and_return(true)
- @ohai._require_plugin("aix::platform")
+ @plugin = get_plugin("aix/platform")
+ @plugin.stub(:collect_os).and_return(:aix)
+ kernel = Mash.new
+ kernel[:name] = "aix"
+ kernel[:version] = "1"
+ kernel[:release] = "0"
+ @plugin.stub(:kernel).and_return(kernel)
+ @plugin.run
end
it "should set platform to aix" do
- @ohai[:platform].should == "aix"
+ @plugin[:platform].should == "aix"
end
it "should set the platform_version" do
- @ohai[:platform_version].should == "1.0"
+ @plugin[:platform_version].should == "1.0"
end
it "should set platform_family" do
- @ohai[:platform_family].should == @ohai[:platform]
+ @plugin[:platform_family].should == @plugin[:platform]
end
end
diff --git a/spec/unit/plugins/aix/uptime_spec.rb b/spec/unit/plugins/aix/uptime_spec.rb
index 0fd0afa8..bf7716c1 100644
--- a/spec/unit/plugins/aix/uptime_spec.rb
+++ b/spec/unit/plugins/aix/uptime_spec.rb
@@ -20,21 +20,20 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
describe Ohai::System, "Aix plugin uptime" do
before(:each) do
- @ohai = Ohai::System.new
- @ohai[:os] = "aix"
- @ohai._require_plugin("uptime")
- @ohai.stub(:popen4).with("who -b").and_yield(nil, StringIO.new, StringIO.new(" . system boot Jul 9 17:51"), nil)
-
+ @plugin = get_plugin("aix/uptime")
+ @plugin.stub(:collect_os).and_return(:aix)
Time.stub_chain(:now, :to_i).and_return(1374258600)
DateTime.stub_chain(:parse, :strftime, :to_i).and_return(1373392260)
- @ohai._require_plugin("aix::uptime")
+ @plugin.stub(:popen4).with("who -b").and_yield(nil, StringIO.new, StringIO.new(" . system boot Jul 9 17:51"), nil)
+
+ @plugin.run
end
it "should set uptime_seconds to uptime" do
- @ohai[:uptime_seconds].should == 866340
+ @plugin[:uptime_seconds].should == 866340
end
it "should set uptime to a human readable date" do
- @ohai[:uptime].should == "10 days 00 hours 39 minutes 00 seconds"
+ @plugin[:uptime].should == "10 days 00 hours 39 minutes 00 seconds"
end
end