2017-08-15 18:41:24 +00:00
|
|
|
# encoding: utf-8
|
|
|
|
# author: Dominik Richter
|
|
|
|
# author: Christoph Hartmann
|
|
|
|
|
|
|
|
require 'functional/helper'
|
|
|
|
require 'jsonschema'
|
|
|
|
|
2017-09-23 07:16:25 +00:00
|
|
|
describe 'inspec check' do
|
2017-08-15 18:41:24 +00:00
|
|
|
include FunctionalHelper
|
|
|
|
|
2017-09-23 07:16:25 +00:00
|
|
|
describe 'inspec check with json formatter' do
|
|
|
|
it 'can check a profile and produce valid JSON' do
|
|
|
|
out = inspec('check ' + integration_test_path + ' --format json')
|
|
|
|
out.exit_status.must_equal 0
|
|
|
|
JSON.parse(out.stdout)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'inspec check with special characters in path' do
|
|
|
|
it 'can check a profile with special characters in its path' do
|
|
|
|
out = inspec('check ' + File.join(profile_path, '{{special-path}}'))
|
|
|
|
out.exit_status.must_equal 0
|
|
|
|
end
|
2017-08-15 18:41:24 +00:00
|
|
|
end
|
2017-11-29 12:32:40 +00:00
|
|
|
|
|
|
|
describe 'inspec check with skipping/failing a resource in FilterTable' do
|
|
|
|
it 'can check a profile with special characters in its path' do
|
|
|
|
out = inspec('check ' + File.join(profile_path, 'profile-with-resource-exceptions'))
|
|
|
|
out.exit_status.must_equal 0
|
|
|
|
end
|
|
|
|
end
|
2017-12-05 13:13:41 +00:00
|
|
|
|
|
|
|
describe 'inspec check with a profile containing only_if' do
|
|
|
|
it 'ignores the `only_if`' do
|
|
|
|
out = inspec('check ' + File.join(profile_path, 'only-if-os-nope'))
|
|
|
|
out.exit_status.must_equal 0
|
|
|
|
end
|
|
|
|
end
|
2017-08-15 18:41:24 +00:00
|
|
|
end
|