-
Notifications
You must be signed in to change notification settings - Fork 682
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
parse_config and parse_config_file does not show fully info when test fails (or even if it succedes) #1147
Comments
This issue also happens when using curl = 'curl http://127.0.0.1/php_status'
output = command(curl).stdout
# php5-fpm status putput is in 'key:val' format, and we do not allow multiple values
options = {
assignment_re: /^\s*([^:]*?)\s*:\s*(.*?)\s*$/,
multiple_values: false
}
# process the output
describe parse_config(output, options) do
its('pool') { should eq 'www'}
its('process manager') { should eq process_manager }
its('listen queue') { should be < 100 }
its('max children reached') { should eq 0 }
end
end |
In addition |
also I think it should return more verbose output when using .parse['param'] like below: control 'php5-fpm-status-extended' do
impact 1.0
title 'php5-fpm service status via web - extended'
desc 'php5-fpm service status via web - extended'
curl = 'curl http://127.0.0.1/php_status'
output = command(curl).stdout
# php5-fpm status putput is in 'key:val' format, and we do not allow multiple values
options = {
assignment_re: /^\s*([^:]*?)\s*:\s*(.*?)\s*$/,
multiple_values: false
}
# process the output
describe parse_config(output, options) do
its('pool') { should eq 'www'}
its('process manager') { should eq process_manager }
end
describe parse_config(output, options).params['listen queue'].to_i do
it { should be < 100 }
end
describe parse_config(output, options).params['max children reached'].to_i do
it { should eq 0 }
end
# cleanup of the temporary file
#command('rm -f /tmp/inspec.php5-fpm-status.curl.txt').stdout
end
outputs: ✔ php5-fpm-status-extended: php5-fpm service status via web - extended
✔ Parse Config pool should eq "www"
✔ Parse Config process manager should eq "static"
✔ 0 should be < 100
✔ 0 should eq 0
The last two lines are mystery :D |
@nvtkaszpir just tested with newest inspec (1.1.0) and received this output: does that meet your expectations for the output? |
looks good. |
thanks, closing the issue. |
Description
This is similar issue as #1093 but found out when using
parse_config_file
.When using
parse_config_file
in the test and it fails then the message is missing detailed explanation what actually failed - unless you have insanely detailed tests.InSpec and Platform Version
inspec 0.35.0
ubuntu 15.10 testing remotely on 14.04
Replication Case
in
/tmp/inspec.php5-fpm-status.curl.txt
write below code:Then use below test file
output:
Looking at the test output we cannot see what exactly failed.
expected output:
Of course the issue is that test verifies integers to strings...
Possible Solutions
This is similar issue as #1093
Stacktrace
No stacktrace.
The text was updated successfully, but these errors were encountered: