summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorrichard mcleod <rmcleod8@bloomberg.net>2017-09-01 14:22:41 -0400
committerrichard mcleod <rmcleod8@bloomberg.net>2017-09-01 14:30:22 -0400
commita21e33bb434c99ba988455493022dca7ec447619 (patch)
treea2181ff813c37b46d9d7455bd928e2cc2e5511bd /spec
parent1b511f066ecfc07763f7a09ffbfc76ad61d1092f (diff)
downloadohai-a21e33bb434c99ba988455493022dca7ec447619.tar.gz
changing method to gather AIX uptime
Signed-off-by: richard mcleod <richard.mcleod@gmail.com>
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/plugins/aix/uptime_spec.rb17
1 files changed, 8 insertions, 9 deletions
diff --git a/spec/unit/plugins/aix/uptime_spec.rb b/spec/unit/plugins/aix/uptime_spec.rb
index d04403f8..cabe1d64 100644
--- a/spec/unit/plugins/aix/uptime_spec.rb
+++ b/spec/unit/plugins/aix/uptime_spec.rb
@@ -23,19 +23,18 @@ describe Ohai::System, "Aix plugin uptime" do
before(:each) do
@plugin = get_plugin("aix/uptime")
allow(@plugin).to receive(:collect_os).and_return(:aix)
- allow(Time).to receive_message_chain(:now, :to_i).and_return(1412072511)
- allow(Time).to receive_message_chain(:now, :zone).and_return("IST")
- allow(DateTime).to receive_message_chain(:parse, :strftime, :to_i).and_return(1411561320)
- allow(@plugin).to receive(:shell_out).with("who -b").and_return(mock_shell_out(0, " . system boot Sep 24 17:52", nil))
-
+ allow(@plugin).to receive(:shell_out).and_call_original
+ allow(Time).to receive_message_chain(:now, :to_i).and_return(1504287957)
+ allow(@plugin).to receive(:shell_out).with("LC_ALL=POSIX ps -o etime= -p 1").and_return(mock_shell_out(0,"1148-20:54:50", nil))
+
@plugin.run
end
- it "should set uptime_seconds to uptime" do
- expect(@plugin[:uptime_seconds]).to eq(511191)
+ it "should set uptime_seconds to uptime with days" do
+ expect(@plugin[:uptime_seconds]).to eq(1405025467)
end
- it "should set uptime to a human readable date" do
- expect(@plugin[:uptime]).to eq("5 days 21 hours 59 minutes 51 seconds")
+ it "should set uptime to a human readable date with days" do
+ expect(@plugin[:uptime]).to eq("1148 days 20 hours 54 minutes 50 seconds")
end
end