diff options
author | Sean Zachariasen <thewyzard@hotmail.com> | 2018-02-14 13:30:27 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-14 13:30:27 -0700 |
commit | 54303a1260a7bdab12af4e65a8a2b4e6d3f0585a (patch) | |
tree | 108a16db92388065fb377ecd1794ac1c2cbc9e4c /spec/unit | |
parent | f8186448672814136420365252a5ab75ffe6f655 (diff) | |
parent | f2b345a4314a19929fe7271bd3eaee1f590a695f (diff) | |
download | ohai-54303a1260a7bdab12af4e65a8a2b4e6d3f0585a.tar.gz |
Merge branch 'master' into lxd-update
Diffstat (limited to 'spec/unit')
-rw-r--r-- | spec/unit/plugins/aix/uptime_spec.rb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/spec/unit/plugins/aix/uptime_spec.rb b/spec/unit/plugins/aix/uptime_spec.rb index f9bf2368..d3cf47c8 100644 --- a/spec/unit/plugins/aix/uptime_spec.rb +++ b/spec/unit/plugins/aix/uptime_spec.rb @@ -24,15 +24,19 @@ 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(@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 + it "should set uptime_seconds and uptime standard case" do + 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 expect(@plugin[:uptime_seconds]).to eq(99262490) + expect(@plugin[:uptime]).to eq("1148 days 20 hours 54 minutes 50 seconds") end - 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") + it "should set uptime_seconds and uptime in the whitespace case" do + allow(@plugin).to receive(:shell_out).with("LC_ALL=POSIX ps -o etime= -p 1").and_return(mock_shell_out(0, " 2-20:54:50", nil)) + @plugin.run + expect(@plugin[:uptime_seconds]).to eq(248090) + expect(@plugin[:uptime]).to eq("2 days 20 hours 54 minutes 50 seconds") end end |