diff options
author | rmcleod8 <richard.mcleod@gmail.com> | 2017-10-13 21:09:48 -0400 |
---|---|---|
committer | rmcleod8 <richard.mcleod@gmail.com> | 2017-10-13 21:09:48 -0400 |
commit | ab39254709aa79abac9d29fe5654551ff4e6b23d (patch) | |
tree | 4574f5b1796664187ce46ff8915599158f88b447 | |
parent | aee8f652943a8365b08ecf23f89180de55044e50 (diff) | |
download | ohai-ab39254709aa79abac9d29fe5654551ff4e6b23d.tar.gz |
Updating AIX uptime_seconds to reflect elapsed seconds from boot rather than epoch
Signed-off-by: rmcleod8 <richard.mcleod@gmail.com>
-rw-r--r-- | lib/ohai/plugins/aix/uptime.rb | 2 | ||||
-rw-r--r-- | spec/unit/plugins/aix/uptime_spec.rb | 3 |
2 files changed, 2 insertions, 3 deletions
diff --git a/lib/ohai/plugins/aix/uptime.rb b/lib/ohai/plugins/aix/uptime.rb index 8adc78d0..9b295b9d 100644 --- a/lib/ohai/plugins/aix/uptime.rb +++ b/lib/ohai/plugins/aix/uptime.rb @@ -46,7 +46,7 @@ Ohai.plugin(:Uptime) do end elapsed_seconds = ((d.to_i * 86400) + (h.to_i * 3600) + (m.to_i * 60) + s.to_i) - uptime_seconds Time.now.to_i - elapsed_seconds + uptime_seconds elapsed_seconds uptime seconds_to_human(elapsed_seconds) end end diff --git a/spec/unit/plugins/aix/uptime_spec.rb b/spec/unit/plugins/aix/uptime_spec.rb index 018bcf22..f9bf2368 100644 --- a/spec/unit/plugins/aix/uptime_spec.rb +++ b/spec/unit/plugins/aix/uptime_spec.rb @@ -24,13 +24,12 @@ describe Ohai::System, "Aix plugin uptime" do @plugin = get_plugin("aix/uptime") allow(@plugin).to receive(:collect_os).and_return(:aix) 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 with days" do - expect(@plugin[:uptime_seconds]).to eq(1405025467) + expect(@plugin[:uptime_seconds]).to eq(99262490) end it "should set uptime to a human readable date with days" do |