diff options
author | Tim Smith <tsmith@chef.io> | 2017-10-20 10:05:19 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-20 10:05:19 -0700 |
commit | abb58900f7f719d7f4bf056cebc6400b622e8710 (patch) | |
tree | 75757b5e1ccb0f04ac4658fa6b1f66fea8454b03 | |
parent | aee8f652943a8365b08ecf23f89180de55044e50 (diff) | |
parent | 2ae5cf46c67135a4ff4febccfdc199e1e90927fc (diff) | |
download | ohai-abb58900f7f719d7f4bf056cebc6400b622e8710.tar.gz |
Merge pull request #1075 from rmcleod8/aix_uptime_seconds
Updating AIX uptime_seconds to reflect elapsed seconds from boot rather than epoch
-rw-r--r-- | lib/ohai/plugins/aix/uptime.rb | 3 | ||||
-rw-r--r-- | spec/unit/plugins/aix/uptime_spec.rb | 3 |
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/ohai/plugins/aix/uptime.rb b/lib/ohai/plugins/aix/uptime.rb index 8adc78d0..85537ba7 100644 --- a/lib/ohai/plugins/aix/uptime.rb +++ b/lib/ohai/plugins/aix/uptime.rb @@ -46,7 +46,8 @@ 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 below will return the elapsed time since boot + 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 |