Skip to content
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

Multiple matchers in a describe block display only a single line #1025

Closed
webframp opened this issue Sep 6, 2016 · 3 comments
Closed

Multiple matchers in a describe block display only a single line #1025

webframp opened this issue Sep 6, 2016 · 3 comments

Comments

@webframp
Copy link
Contributor

webframp commented Sep 6, 2016

Description

I'm experimenting with replacing some serverspec test kitchen suites with inspec tests and overall it's great. Very fast and I love the small dsl improvements from inspec over serverspec.

Unfortunately the displayed output is not quite useful enough to include them as the default in our CI process yet. This seems related to #812 so perhaps it's a configuration I'm missing, fixed in a future version or just my ignorance.

For a simple spec such as:

describe file('/tmp/home_test/.ssh/id_rsa') do
  it { should be_file }
  its('size') { should > 0 }
  its('mode') { should cmp '0600' }
end

the output is condensed to a single line:

 ✔  File /tmp/home_test/.ssh/id_rsa should be file; File /tmp/ho...

but I would expect it to instead display one per line like:

✔  File /tmp/home_test/.ssh/id_rsa should be file
✔  File /tmp/home_test/.ssh/id_rsa size should > 0
✔  File /tmp/home_test/.ssh/id_rsa mode should cmp "0600"

I can duplicate the describe block many times, using one matcher per describe block to get the desired output, but this seems like needless duplication.

InSpec and Platform Version

Running on Windows 10, Powershell 5
inspec 0.29.0 from the chef-dk 17.17
kitchen 1.11.1, kitchen-vagrant (0.20.0), kitchen-inspec (0.15.0)
Testing in an ubuntu 14.04 vm

Replication Case

Simple test recipe:

file '/tmp/home_test/.ssh/id_rsa' do
  content "fake contents"
  mode '0600'
end

matching spec (condensed):

describe file('/tmp/home_test/.ssh/id_rsa') do
  it { should be_file }
  its('size') { should > 0 }
  its('mode') { should cmp '0600' }
end

spec (expanded):

describe file('/tmp/home_test/.ssh/id_rsa') do
  it { should be_file }
end

describe file('/tmp/home_test/.ssh/id_rsa') do
  its('size') { should > 0 }
end

describe file('/tmp/home_test/.ssh/id_rsa') do
  its('mode') { should cmp '0600' }
end

Possible Solutions

For now I've kept a single matcher per describe block which provides the output desired, but needlessly duplicates describe blocks

Stacktrace

none

@chris-rock
Copy link
Contributor

@webframp Try to update to the latest InSpec release 0.33.0 since we improved the reporter a lot over the last weeks. Let us know if the issue persists

@webframp
Copy link
Contributor Author

webframp commented Sep 6, 2016

Confirmed, 0.33.0 fixes the output as expected:

  File /tmp/home_test/.ssh/id_rsa
     ✔  should be file
     ✔  size should > 0

Thanks!

@chris-rock
Copy link
Contributor

Perfect @webframp Thanks for using InSpec. Let us know if you have any other issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants