mirror of
https://github.com/inspec/inspec
synced 2024-11-26 22:50:36 +00:00
add tests for os resource
This commit is contained in:
parent
9e753a5dbc
commit
e9ca7107b0
2 changed files with 41 additions and 1 deletions
|
@ -51,7 +51,7 @@ class MockLoader
|
|||
ubuntu1204: { family: 'ubuntu', release: '12.04', arch: 'x86_64' },
|
||||
ubuntu1404: { family: 'ubuntu', release: '14.04', arch: 'x86_64' },
|
||||
ubuntu1504: { family: 'ubuntu', release: '15.04', arch: 'x86_64' },
|
||||
windows: { family: 'windows', release: nil, arch: nil },
|
||||
windows: { family: 'windows', release: '6.2.9200', arch: 'x86_64' },
|
||||
wrlinux: { family: 'wrlinux', release: '7.0(3)I2(2)', arch: 'x86_64' },
|
||||
solaris11: { family: "solaris", release: '11', arch: 'i386'},
|
||||
solaris10: { family: "solaris", release: '10', arch: 'i386'},
|
||||
|
|
40
test/unit/resources/os_test.rb
Normal file
40
test/unit/resources/os_test.rb
Normal file
|
@ -0,0 +1,40 @@
|
|||
# encoding: utf-8
|
||||
# author: Christoph Hartmann
|
||||
# author: Dominik Richter
|
||||
|
||||
require 'helper'
|
||||
require 'inspec/resource'
|
||||
|
||||
describe 'Inspec::Resources::Os' do
|
||||
it 'verify os parsing on CentOS' do
|
||||
resource = MockLoader.new(:centos7).load_resource('os')
|
||||
_(resource.name).must_equal nil
|
||||
_(resource.family).must_equal 'redhat'
|
||||
_(resource.release).must_equal '7.1.1503'
|
||||
_(resource.arch).must_equal 'x86_64'
|
||||
end
|
||||
|
||||
it 'read env variable on Windows' do
|
||||
resource = MockLoader.new(:windows).load_resource('os')
|
||||
_(resource.name).must_equal nil
|
||||
_(resource.family).must_equal 'windows'
|
||||
_(resource.release).must_equal '6.2.9200'
|
||||
_(resource.arch).must_equal 'x86_64'
|
||||
end
|
||||
|
||||
it 'verify os parsing on Debian' do
|
||||
resource = MockLoader.new(:debian8).load_resource('os')
|
||||
_(resource.name).must_equal nil
|
||||
_(resource.family).must_equal 'debian'
|
||||
_(resource.release).must_equal '8'
|
||||
_(resource.arch).must_equal 'x86_64'
|
||||
end
|
||||
|
||||
it 'verify os parsing on Ubuntu' do
|
||||
resource = MockLoader.new(:ubuntu1504).load_resource('os')
|
||||
_(resource.name).must_equal nil
|
||||
_(resource.family).must_equal 'ubuntu'
|
||||
_(resource.release).must_equal '15.04'
|
||||
_(resource.arch).must_equal 'x86_64'
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue