2019-06-11 22:24:35 +00:00
|
|
|
require "helper"
|
|
|
|
require "inspec/resource"
|
|
|
|
require "inspec/resources/filesystem"
|
2018-01-25 14:29:31 +00:00
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "Inspec::Resources::FileSystemResource" do
|
|
|
|
it "verify filesystem on linux" do
|
2019-10-24 04:41:29 +00:00
|
|
|
resource = quick_resource(:filesystem, :linux, "/") do |cmd|
|
2019-11-09 03:08:20 +00:00
|
|
|
stdout_file "test/fixtures/cmd/df-PT"
|
2019-10-24 04:41:29 +00:00
|
|
|
end
|
|
|
|
|
2019-02-01 05:39:52 +00:00
|
|
|
_(resource.size_kb).must_equal 30428648
|
|
|
|
_(resource.size).must_equal 30428648
|
2019-06-11 22:24:35 +00:00
|
|
|
_(resource.name).must_equal "/"
|
|
|
|
_(resource.type).must_equal "ext4"
|
2019-02-01 05:46:18 +00:00
|
|
|
_(resource.free_kb).must_equal 20760728
|
2019-01-31 22:18:39 +00:00
|
|
|
_(resource.percent_free).must_equal 68
|
2022-06-02 11:40:57 +00:00
|
|
|
_(resource.resource_id).must_equal "/"
|
2018-11-19 18:32:59 +00:00
|
|
|
end
|
2019-01-31 22:18:39 +00:00
|
|
|
|
2019-02-01 05:46:18 +00:00
|
|
|
# windows
|
2019-06-11 22:24:35 +00:00
|
|
|
it "verify filesystem on windows" do
|
|
|
|
resource = MockLoader.new(:windows).load_resource("filesystem", "c:")
|
2019-02-01 05:39:52 +00:00
|
|
|
_(resource.size).must_equal 38 # Windows size() had a bug that turned it into GB, not KB
|
|
|
|
_(resource.size_kb).must_equal 40000000 # approx 38 GB
|
2019-06-11 22:24:35 +00:00
|
|
|
_(resource.name).must_equal "c:"
|
|
|
|
_(resource.type).must_equal "NTFS"
|
2019-02-01 05:46:18 +00:00
|
|
|
_(resource.free_kb).must_equal 30000000
|
2019-02-01 05:39:52 +00:00
|
|
|
_(resource.percent_free).must_equal 75
|
2022-06-02 11:40:57 +00:00
|
|
|
_(resource.resource_id).must_equal "c:"
|
2018-01-25 14:29:31 +00:00
|
|
|
end
|
|
|
|
end
|