2015-12-14 13:23:41 +00:00
|
|
|
# encoding: utf-8
|
2016-03-24 19:19:14 +00:00
|
|
|
# copyright: 2016, Chef Software, Inc.
|
2015-12-14 13:23:41 +00:00
|
|
|
# license: All rights reserved
|
|
|
|
|
|
|
|
title 'Gordon Config Checks'
|
|
|
|
|
|
|
|
# To pass the test, create the following file
|
|
|
|
# ```bash
|
2016-03-24 19:19:14 +00:00
|
|
|
# mkdir -p /tmp/gordon
|
|
|
|
# cat <<EOF > /tmp/gordon/config.yaml
|
2015-12-14 13:23:41 +00:00
|
|
|
# version: '1.0'
|
|
|
|
# EOF
|
|
|
|
# ```
|
|
|
|
control 'gordon-1.0' do
|
|
|
|
impact 0.7
|
2015-12-31 20:27:42 +00:00
|
|
|
title 'Verify the version number of Gordon'
|
2015-12-14 13:23:41 +00:00
|
|
|
desc 'An optional description...'
|
2016-03-27 16:40:34 +00:00
|
|
|
tag 'gordon'
|
2016-03-27 22:48:15 +00:00
|
|
|
ref 'Gordon Requirements 1.0', uri: 'http://...'
|
2016-03-27 16:40:34 +00:00
|
|
|
|
2016-04-04 12:48:42 +00:00
|
|
|
# Test using the custom gordon_config Inspec resource
|
|
|
|
# Find the resource content here: ../libraries/
|
2015-12-14 13:23:41 +00:00
|
|
|
describe gordon_config do
|
2016-04-04 12:48:42 +00:00
|
|
|
it { should exist }
|
2015-12-14 13:23:41 +00:00
|
|
|
its('version') { should eq('1.0') }
|
2016-04-04 12:48:42 +00:00
|
|
|
its('file_size') { should <= 20 }
|
|
|
|
its('comma_count') { should eq 0 }
|
|
|
|
end
|
|
|
|
|
|
|
|
# Test the version again to showcase variables
|
|
|
|
g = gordon_config
|
|
|
|
g_path = g.file_path
|
|
|
|
g_version = g.version
|
|
|
|
describe file(g_path) do
|
|
|
|
its('content') { should match g_version }
|
2015-12-14 13:23:41 +00:00
|
|
|
end
|
|
|
|
end
|