diff options
author | Shahul Hameed <skhajamohid1@bloomberg.net> | 2015-08-19 11:03:10 -0400 |
---|---|---|
committer | Shahul Hameed <skhajamohid1@bloomberg.net> | 2015-08-19 11:03:10 -0400 |
commit | 2df3e0f435020bb5cf29c2a2b151aa265dcca68e (patch) | |
tree | 5da7509665b4475b6bdf77df948c26a5f4696c07 | |
parent | e05e5a7e70d442ca108f71581f0b2830b868b133 (diff) | |
download | ohai-2df3e0f435020bb5cf29c2a2b151aa265dcca68e.tar.gz |
Make windows memory plugin consistent with linux
-rw-r--r-- | lib/ohai/plugins/windows/memory.rb | 8 | ||||
-rw-r--r-- | spec/unit/plugins/windows/memory_spec.rb | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/lib/ohai/plugins/windows/memory.rb b/lib/ohai/plugins/windows/memory.rb index 1718e53b..f62d84db 100644 --- a/lib/ohai/plugins/windows/memory.rb +++ b/lib/ohai/plugins/windows/memory.rb @@ -27,12 +27,12 @@ Ohai.plugin(:Memory) do os = wmi.first_of("Win32_OperatingSystem") # MemTotal - memory[:total] = os["TotalVisibleMemorySize"].to_i / 1024.0 + memory[:total] = os["TotalVisibleMemorySize"] + "kB" # MemFree - memory[:free] = os["FreePhysicalMemory"].to_i / 1024.0 + memory[:free] = os["FreePhysicalMemory"] + "kB" # SwapTotal - memory[:swap][:total] = os["SizeStoredInPagingFiles"].to_i / 1024.0 + memory[:swap][:total] = os["SizeStoredInPagingFiles"] + "kB" # SwapFree - memory[:swap][:free] = os["FreeSpaceInPagingFiles"].to_i / 1024.0 + memory[:swap][:free] = os["FreeSpaceInPagingFiles"] + "kB" end end
\ No newline at end of file diff --git a/spec/unit/plugins/windows/memory_spec.rb b/spec/unit/plugins/windows/memory_spec.rb index 76fe7c80..db9de630 100644 --- a/spec/unit/plugins/windows/memory_spec.rb +++ b/spec/unit/plugins/windows/memory_spec.rb @@ -31,22 +31,22 @@ describe Ohai::System, "Windows memory plugin", :windows_only do it "should get total memory" do @plugin.run - expect(@plugin["memory"]["total"]).to eql(10485760 / 1024.0) + expect(@plugin["memory"]["total"]).to eql("10485760kB") end it "should get free memory" do @plugin.run - expect(@plugin["memory"]["free"]).to eql(5242880 / 1024.0) + expect(@plugin["memory"]["free"]).to eql("5242880kB") end it "should get total swap" do @plugin.run - expect(@plugin["memory"]["swap"]["total"]).to eql(20971520 / 1024.0) + expect(@plugin["memory"]["swap"]["total"]).to eql("20971520kB") end it "should get free memory" do @plugin.run - expect(@plugin["memory"]["swap"]["free"]).to eql(15728640 / 1024.0) + expect(@plugin["memory"]["swap"]["free"]).to eql("15728640kB") end end
\ No newline at end of file |