mirror of
https://github.com/inspec/inspec
synced 2024-09-21 15:02:01 +00:00
Merge pull request #1148 from nvtkaszpir/patch-2
Extend example for parse_config.rb
This commit is contained in:
commit
a588c7599e
1 changed files with 18 additions and 1 deletions
|
@ -19,10 +19,27 @@ module Inspec::Resources
|
|||
desc 'Use the parse_config InSpec audit resource to test arbitrary configuration files.'
|
||||
example "
|
||||
output = command('some-command').stdout
|
||||
|
||||
describe parse_config(output, { data_config_option: value } ) do
|
||||
its('setting') { should eq 1 }
|
||||
end
|
||||
|
||||
output2 = command('curl http://127.0.0.1/php_status').stdout
|
||||
# php status is in format 'key : value', and we do not allow for multiple values
|
||||
options2 = {
|
||||
assignment_re: /^\s*([^:]*?)\s*:\s*(.*?)\s*$/,
|
||||
multiple_values: false
|
||||
}
|
||||
|
||||
describe parse_config(output2, options2) do
|
||||
its('pool') { should eq 'www'}
|
||||
its('process manager') { should eq process_manager }
|
||||
end
|
||||
|
||||
# getting specific key from the output above, convert it to integer and then compare
|
||||
# make sure 'listen queue' is below 100
|
||||
describe parse_config(output2, options2 ).params['listen queue'].to_i do
|
||||
it { should be < 100 }
|
||||
end
|
||||
"
|
||||
|
||||
attr_reader :content
|
||||
|
|
Loading…
Reference in a new issue