2018-01-25 14:29:31 +00:00
|
|
|
require 'helper'
|
|
|
|
|
|
|
|
describe 'Inspec::Resources::FileSystemResource' do
|
2018-11-19 18:32:59 +00:00
|
|
|
# arch linux
|
|
|
|
it 'verify filesystem on linux' do
|
2019-01-31 22:18:39 +00:00
|
|
|
resource = MockLoader.new(:ubuntu1404).load_resource('filesystem','/')
|
2019-02-01 05:39:52 +00:00
|
|
|
_(resource.size_kb).must_equal 30428648
|
|
|
|
_(resource.size).must_equal 30428648
|
2018-11-19 18:32:59 +00:00
|
|
|
_(resource.name).must_equal '/'
|
2019-01-29 21:23:05 +00:00
|
|
|
_(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
|
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
|
2018-11-19 18:32:59 +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
|
2018-11-19 18:32:59 +00:00
|
|
|
_(resource.name).must_equal 'c:'
|
2019-01-29 21:23:05 +00:00
|
|
|
_(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
|
2018-01-25 14:29:31 +00:00
|
|
|
end
|
|
|
|
|
2018-11-19 18:32:59 +00:00
|
|
|
# unsuported os
|
|
|
|
describe 'when loading filesystem in unsupported OS family' do
|
2018-01-25 14:29:31 +00:00
|
|
|
it 'fails on FreeBSD (unix-like)' do
|
|
|
|
resource_fail = MockLoader.new(:freebsd10).load_resource('filesystem', '/')
|
2018-02-16 20:15:53 +00:00
|
|
|
resource_fail.check_supports.must_equal false
|
2018-01-25 14:29:31 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|