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

Grouping multiple it blocks in one describe blocks ruins console output during test runs #918

Closed
davidcpell opened this issue Aug 15, 2016 · 5 comments · Fixed by #946
Closed
Labels
Type: Bug Feature not working as expected
Milestone

Comments

@davidcpell
Copy link
Contributor

Description

In rspec and serverspec I'm used to being able to group multiple it blocks within a single describe block. With inspec I can do this but the console output doesn't seem to work correctly. Here is my example spec code:

describe user('david') do
  it { should exist }
  its(:home) { should eq '/home/david' }
  its(:shell) { should eq '/bin/zsh' }
end

When I run the tests, I get a checkmark but otherwise blank output in the console:

➜  dotfiles git:(master) ✗ ce kitchen verify default-ubuntu-1404                                                                                                      [6/140]
-----> Starting Kitchen (v1.10.2)
-----> Setting up <default-ubuntu-1404>...
       Finished setting up <default-ubuntu-1404> (0m0.00s).
-----> Verifying <default-ubuntu-1404>...
       Use `/Users/david/code/chef/chef_repos/david-workstation/cookbooks/dotfiles/test/recipes/default` for testing

Target:  ssh://vagrant@127.0.0.1:2222

  ✔

Summary: 3 successful, 0 failures, 0 skipped

In order to get output I have to include 3 separate describe blocks:

describe user('david') do
  it { should exist }
end

describe user('david') do
  its(:home) { should eq '/home/david' }
end

describe user('david') do
  its(:shell) { should eq '/bin/zsh' }
end

...which outputs this:

➜  dotfiles git:(master) ✗ ce kitchen verify default-ubuntu-1404
-----> Starting Kitchen (v1.10.2)
-----> Verifying <default-ubuntu-1404>...
       Use `/Users/david/code/chef/chef_repos/david-workstation/cookbooks/dotfiles/test/recipes/default` for testing

Target:  ssh://vagrant@127.0.0.1:2222

  ✔  User david should exist
  ✔  User david home should eq "/home/david"
  ✔  User david shell should eq "/bin/zsh"

Summary: 3 successful, 0 failures, 0 skipped

However the expected/desired output would be more like this:

     User david 
       ✔      home should eq "/home/david"
       ✔      shell should eq "/bin/zsh"
       ✔      should exist

Summary: 3 successful, 0 failures, 0 skipped

Is the current behavior expected/desired?

InSpec and Platform Version

Inspec v0.28.0
Mac OSX 10.11.6

Replication Case

Create an inspec test with multipe it blocks in a single describe block.

@chris-rock
Copy link
Contributor

This should have been fixed with InSpec 0.29.0 as reported in #812

@davidcpell
Copy link
Contributor Author

@chris-rock thanks, though I just upgraded to InSpec 0.30.0 and still seem to be getting the same console output:

➜  dotfiles git:(master) ✗ which inspec
/Users/david/.chefdk/gem/ruby/2.1.0/bin/inspec
➜  dotfiles git:(master) ✗ inspec version
0.30.0
➜  dotfiles git:(master) ✗ ce kitchen verify default-ubuntu-1404
-----> Starting Kitchen (v1.10.2)
-----> Verifying <default-ubuntu-1404>...
       Use `/Users/david/code/chef/chef_repos/david-workstation/cookbooks/dotfiles/test/recipes/default` for testing

Target:  ssh://vagrant@127.0.0.1:2222

  ✖  File /home/david/.oh-my-zsh should be directoryexpected `File /home/david/.oh-my-zsh.directory?` to return true, got false
  ✔

Summary: 3 successful, 1 failures, 0 skipped

@davidcpell
Copy link
Contributor Author

note also the lack of line break/other formatting to separate the two lines in the .oh-my-zsh failure

@chris-rock chris-rock added the Type: Bug Feature not working as expected label Aug 15, 2016
@chris-rock chris-rock added this to the 1.0.0 milestone Aug 15, 2016
@chris-rock
Copy link
Contributor

@davidcpell thanks for the quick testing!

@davidcpell
Copy link
Contributor Author

yw!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Feature not working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants