inspec/test/unit/resources/filesystem_test.rb
mhackethal 86cf55382b filesystem: improve Windows support (#3606)
* Improve filesystem.rb to support windows

improve filesystem.rb to support windows.
Split into 2 classes LinuxFileSystemResource / WindowsFileSystemResource
Add filesystem to verify a FS-type ( currently not for linux because missing test server )
Size on Windows is converted to GB - discussion about this welcome

update to reflect also windows os

* Create get-wmiobject-filesystem
* Delete get-wmiobject-filesystem

* Fix the testing code for filesystem.
Change its 'filesystem' to 'type' according to recommendation from @miah
Signed-off-by: Markus Hackethal <mh@it31.de>
2018-11-19 13:32:59 -05:00

26 lines
790 B
Ruby

require 'helper'
require 'inspec/resource'
describe 'Inspec::Resources::FileSystemResource' do
# arch linux
it 'verify filesystem on linux' do
resource = MockLoader.new(:ubuntu1404).load_resource('filesystem','/')
_(resource.size).must_be :>=, 1
_(resource.name).must_equal '/'
end
# arch windows
it 'verify filesystem on windows' do
resource = MockLoader.new(:windows).load_resource('filesystem','c:')
_(resource.size).must_be :>=, 1
_(resource.name).must_equal 'c:'
end
# unsuported os
describe 'when loading filesystem in unsupported OS family' do
it 'fails on FreeBSD (unix-like)' do
resource_fail = MockLoader.new(:freebsd10).load_resource('filesystem', '/')
resource_fail.check_supports.must_equal false
end
end
end