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

More chefspec test coverage #190

Closed
jjasghar opened this issue Dec 18, 2014 · 8 comments

Comments

Projects
None yet
2 participants
@jjasghar
Copy link
Collaborator

commented Dec 18, 2014

Thanks @wenchma for taking this task.

Right now we have this:

ChefSpec Coverage report generated...

  Total Resources:   51
  Touched Resources: 11
  Touch Coverage:    21.57%

Untouched Resources:

  remote_file[/var/folders/hl/zf_j1bvs7_b18rj7bbsm35p00000gp/T/d20141218-7153-149cnve/rabbitmq-server-3.4.2-1.noarch.rpm]   rabbitmq/recipes/default.rb:108
  rpm_package[/var/folders/hl/zf_j1bvs7_b18rj7bbsm35p00000gp/T/d20141218-7153-149cnve/rabbitmq-server-3.4.2-1.noarch.rpm]   rabbitmq/recipes/default.rb:112
  remote_file[/var/folders/hl/zf_j1bvs7_b18rj7bbsm35p00000gp/T/d20141218-7153-1x48hgo/rabbitmq-server-3.4.2-1.noarch.rpm]   rabbitmq/recipes/default.rb:108
  rpm_package[/var/folders/hl/zf_j1bvs7_b18rj7bbsm35p00000gp/T/d20141218-7153-1x48hgo/rabbitmq-server-3.4.2-1.noarch.rpm]   rabbitmq/recipes/default.rb:112
  remote_file[/var/folders/hl/zf_j1bvs7_b18rj7bbsm35p00000gp/T/d20141218-7153-1cgllj6/rabbitmq-server-3.4.2-1.noarch.rpm]   rabbitmq/recipes/default.rb:108
  rpm_package[/var/folders/hl/zf_j1bvs7_b18rj7bbsm35p00000gp/T/d20141218-7153-1cgllj6/rabbitmq-server-3.4.2-1.noarch.rpm]   rabbitmq/recipes/default.rb:112
  remote_file[/var/folders/hl/zf_j1bvs7_b18rj7bbsm35p00000gp/T/d20141218-7153-1v6kvw6/rabbitmq-server-3.4.2-1.noarch.rpm]   rabbitmq/recipes/default.rb:108
  rpm_package[/var/folders/hl/zf_j1bvs7_b18rj7bbsm35p00000gp/T/d20141218-7153-1v6kvw6/rabbitmq-server-3.4.2-1.noarch.rpm]   rabbitmq/recipes/default.rb:112
  remote_file[/var/folders/hl/zf_j1bvs7_b18rj7bbsm35p00000gp/T/d20141218-7153-1l2wc8o/rabbitmq-server-3.4.2-1.noarch.rpm]   rabbitmq/recipes/default.rb:108
  rpm_package[/var/folders/hl/zf_j1bvs7_b18rj7bbsm35p00000gp/T/d20141218-7153-1l2wc8o/rabbitmq-server-3.4.2-1.noarch.rpm]   rabbitmq/recipes/default.rb:112
  remote_file[/var/folders/hl/zf_j1bvs7_b18rj7bbsm35p00000gp/T/d20141218-7153-1n0b106/rabbitmq-server-3.4.2-1.noarch.rpm]   rabbitmq/recipes/default.rb:108
  rpm_package[/var/folders/hl/zf_j1bvs7_b18rj7bbsm35p00000gp/T/d20141218-7153-1n0b106/rabbitmq-server-3.4.2-1.noarch.rpm]   rabbitmq/recipes/default.rb:112
  remote_file[/var/folders/hl/zf_j1bvs7_b18rj7bbsm35p00000gp/T/d20141218-7153-iw8vjk/rabbitmq-server-3.4.2-1.noarch.rpm]   rabbitmq/recipes/default.rb:108
  rpm_package[/var/folders/hl/zf_j1bvs7_b18rj7bbsm35p00000gp/T/d20141218-7153-iw8vjk/rabbitmq-server-3.4.2-1.noarch.rpm]   rabbitmq/recipes/default.rb:112
  remote_file[/var/folders/hl/zf_j1bvs7_b18rj7bbsm35p00000gp/T/d20141218-7153-1v5mc8p/rabbitmq-server-3.4.2-1.noarch.rpm]   rabbitmq/recipes/default.rb:108
  rpm_package[/var/folders/hl/zf_j1bvs7_b18rj7bbsm35p00000gp/T/d20141218-7153-1v5mc8p/rabbitmq-server-3.4.2-1.noarch.rpm]   rabbitmq/recipes/default.rb:112
  template[/etc/rabbitmq/rabbitmq.config]   rabbitmq/recipes/default.rb:174
  remote_file[/var/folders/hl/zf_j1bvs7_b18rj7bbsm35p00000gp/T/d20141218-7153-bu5v0s/rabbitmq-server_3.4.2-1_all.deb]   rabbitmq/recipes/default.rb:43
  dpkg_package[/var/folders/hl/zf_j1bvs7_b18rj7bbsm35p00000gp/T/d20141218-7153-bu5v0s/rabbitmq-server_3.4.2-1_all.deb]   rabbitmq/recipes/default.rb:47
  dpkg_package[/var/folders/hl/zf_j1bvs7_b18rj7bbsm35p00000gp/T/d20141218-7153-7nzmh7/rabbitmq-server_3.4.2-1_all.deb]   rabbitmq/recipes/default.rb:47
  remote_file[/var/folders/hl/zf_j1bvs7_b18rj7bbsm35p00000gp/T/d20141218-7153-2ogfd8/rabbitmq-server_3.4.2-1_all.deb]   rabbitmq/recipes/default.rb:43
  rpm_package[/var/folders/hl/zf_j1bvs7_b18rj7bbsm35p00000gp/T/d20141218-7153-q836nt/rabbitmq-server-3.4.2-1.noarch.rpm]   rabbitmq/recipes/default.rb:112
  remote_file[/var/folders/hl/zf_j1bvs7_b18rj7bbsm35p00000gp/T/d20141218-7153-tthe44/rabbitmq-server-3.4.2-1.noarch.rpm]   rabbitmq/recipes/default.rb:108
  remote_file[/var/folders/hl/zf_j1bvs7_b18rj7bbsm35p00000gp/T/d20141218-7153-1ytyxqs/rabbitmq-server-3.4.2-1.noarch.rpm]   rabbitmq/recipes/default.rb:108
  rpm_package[/var/folders/hl/zf_j1bvs7_b18rj7bbsm35p00000gp/T/d20141218-7153-1ytyxqs/rabbitmq-server-3.4.2-1.noarch.rpm]   rabbitmq/recipes/default.rb:112
  rabbitmq_plugin[rabbitmq_management]   rabbitmq/recipes/mgmt_console.rb:27
  rabbitmq_plugin[rabbitmq_management_visualiser]   rabbitmq/recipes/mgmt_console.rb:27
  remote_file[/var/folders/hl/zf_j1bvs7_b18rj7bbsm35p00000gp/T/d20141218-7153-17q0r74/rabbitmq-server-3.4.2-1.noarch.rpm]   rabbitmq/recipes/default.rb:108
  rpm_package[/var/folders/hl/zf_j1bvs7_b18rj7bbsm35p00000gp/T/d20141218-7153-17q0r74/rabbitmq-server-3.4.2-1.noarch.rpm]   rabbitmq/recipes/default.rb:112
  remote_file[/var/folders/hl/zf_j1bvs7_b18rj7bbsm35p00000gp/T/d20141218-7153-12jt872/rabbitmq-server-3.4.2-1.noarch.rpm]   rabbitmq/recipes/default.rb:108
  rpm_package[/var/folders/hl/zf_j1bvs7_b18rj7bbsm35p00000gp/T/d20141218-7153-12jt872/rabbitmq-server-3.4.2-1.noarch.rpm]   rabbitmq/recipes/default.rb:112
  rabbitmq_policy[ha-all]            rabbitmq/recipes/policy_management.rb:25
  rabbitmq_policy[ha-two]            rabbitmq/recipes/policy_management.rb:25
  remote_file[/var/folders/hl/zf_j1bvs7_b18rj7bbsm35p00000gp/T/d20141218-7153-h3mogj/rabbitmq-server-3.4.2-1.noarch.rpm]   rabbitmq/recipes/default.rb:108
  rpm_package[/var/folders/hl/zf_j1bvs7_b18rj7bbsm35p00000gp/T/d20141218-7153-h3mogj/rabbitmq-server-3.4.2-1.noarch.rpm]   rabbitmq/recipes/default.rb:112
  rabbitmq_user[guest]               rabbitmq/recipes/user_management.rb:26
  remote_file[/var/folders/hl/zf_j1bvs7_b18rj7bbsm35p00000gp/T/d20141218-7153-16xoi5y/rabbitmq-server-3.4.2-1.noarch.rpm]   rabbitmq/recipes/default.rb:108
  rpm_package[/var/folders/hl/zf_j1bvs7_b18rj7bbsm35p00000gp/T/d20141218-7153-16xoi5y/rabbitmq-server-3.4.2-1.noarch.rpm]   rabbitmq/recipes/default.rb:112
  remote_file[/var/folders/hl/zf_j1bvs7_b18rj7bbsm35p00000gp/T/d20141218-7153-l3qugo/rabbitmq-server-3.4.2-1.noarch.rpm]   rabbitmq/recipes/default.rb:108
  rpm_package[/var/folders/hl/zf_j1bvs7_b18rj7bbsm35p00000gp/T/d20141218-7153-l3qugo/rabbitmq-server-3.4.2-1.noarch.rpm]   rabbitmq/recipes/default.rb:112

As our test coverage. I'd love to see Touch Coverage: 21.57% go to 100%.

@wenchma

This comment has been minimized.

Copy link
Contributor

commented Dec 22, 2014

@jjasghar OK, will add the PR to cover them.

@wenchma

This comment has been minimized.

Copy link
Contributor

commented Dec 29, 2014

I added some missing spec tests, got the following result:
ChefSpec Coverage report generated...

Total Resources: 68
Touched Resources: 22
Touch Coverage: 32.35%

Untouched Resources:

remote_file[/tmp/d20141229-27556-5dycw9/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:108
rpm_package[/tmp/d20141229-27556-5dycw9/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:112
remote_file[/tmp/d20141229-27556-gwlksd/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:108
rpm_package[/tmp/d20141229-27556-gwlksd/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:112
remote_file[/tmp/d20141229-27556-ccndll/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:108
rpm_package[/tmp/d20141229-27556-ccndll/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:112
remote_file[/tmp/d20141229-27556-e3h5ci/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:108
rpm_package[/tmp/d20141229-27556-e3h5ci/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:112
remote_file[/tmp/d20141229-27556-x9mwfu/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:108
rpm_package[/tmp/d20141229-27556-x9mwfu/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:112
remote_file[/tmp/d20141229-27556-akl4xy/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:108
rpm_package[/tmp/d20141229-27556-akl4xy/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:112
remote_file[/tmp/d20141229-27556-1dbna9x/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:108
rpm_package[/tmp/d20141229-27556-1dbna9x/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:112
rpm_package[/tmp/d20141229-27556-vm56ts/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:112
remote_file[/tmp/d20141229-27556-wk3ve3/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:108
remote_file[/tmp/d20141229-27556-2znz5g/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:108
rpm_package[/tmp/d20141229-27556-2znz5g/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:112
remote_file[/tmp/d20141229-27556-68uqbq/rabbitmq-server_3.4.2-1_all.deb] rabbitmq/recipes/default.rb:43
dpkg_package[/tmp/d20141229-27556-68uqbq/rabbitmq-server_3.4.2-1_all.deb] rabbitmq/recipes/default.rb:47
dpkg_package[/tmp/d20141229-27556-7c8dsx/rabbitmq-server_3.4.2-1_all.deb] rabbitmq/recipes/default.rb:47
remote_file[/tmp/d20141229-27556-4t9k1z/rabbitmq-server_3.4.2-1_all.deb] rabbitmq/recipes/default.rb:43
rpm_package[/tmp/d20141229-27556-sp2dsc/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:112
remote_file[/tmp/d20141229-27556-1aynz68/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:108
remote_file[/tmp/d20141229-27556-116fmn6/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:108
rpm_package[/tmp/d20141229-27556-116fmn6/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:112
remote_file[/tmp/d20141229-27556-75h0ni/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:108
rpm_package[/tmp/d20141229-27556-75h0ni/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:112
remote_file[/tmp/d20141229-27556-zsyfc6/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:108
rpm_package[/tmp/d20141229-27556-zsyfc6/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:112
remote_file[/tmp/d20141229-27556-18v4w7t/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:108
rpm_package[/tmp/d20141229-27556-18v4w7t/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:112
remote_file[/tmp/d20141229-27556-3wwxse/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:108
rpm_package[/tmp/d20141229-27556-3wwxse/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:112
remote_file[/tmp/d20141229-27556-p2odp0/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:108
rpm_package[/tmp/d20141229-27556-p2odp0/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:112
remote_file[/tmp/d20141229-27556-1wjirgf/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:108
rpm_package[/tmp/d20141229-27556-1wjirgf/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:112
remote_file[/tmp/d20141229-27556-y6ggzc/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:108
rpm_package[/tmp/d20141229-27556-y6ggzc/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:112
remote_file[/tmp/d20141229-27556-17ubk7l/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:108
rpm_package[/tmp/d20141229-27556-17ubk7l/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:112
remote_file[/tmp/d20141229-27556-cih93g/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:108
rpm_package[/tmp/d20141229-27556-cih93g/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:112
remote_file[/tmp/d20141229-27556-198ftg8/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:108
rpm_package[/tmp/d20141229-27556-198ftg8/rabbitmq-server-3.4.2-1.noarch.rpm] rabbitmq/recipes/default.rb:112

still report some same untouched resources repeatedly for many times, @jjasghar do you have any idea ?

@jjasghar

This comment has been minimized.

Copy link
Collaborator Author

commented Dec 29, 2014

@wenchma Awesome! Yeah, i think it's due to the loop we have it in or something. Adding a rpm_package like here or remote_file like here doesn't fix it?

If not, no worries, we still have a good amount of coverage, can you make the PR?

wenchma pushed a commit to wenchma/rabbitmq that referenced this issue Dec 30, 2014

wenchma
Add more chefspec tests
Add some missing spec tests to cover more chef resources,
but it reports some same untouched resources repeatedly
for many times.

Fixes issue rabbitmq#190
@wenchma

This comment has been minimized.

Copy link
Contributor

commented Jan 7, 2015

@jjasghar the example you said doesn't fix this, maybe it is due to :
By default ChefSpec sets a new temporary directory for file caching in every run.
This can be overridden by passing the file_cache_path option.
Note: Resources containing Chef::Config[:file_cache_path] in their name or
attributes, will fail unless this option is specified.
ChefSpec::SoloRunner.new(file_cache_path: '/var/chef/cache')

https://github.com/sethvargo/chefspec#configuration

but I added the option, it didn't take effect, confused !

@jjasghar

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 8, 2015

So i tried hacking around this too, no go. Can you just pull all the tests that cause this error, and we'll revisit it later on.

wenchma pushed a commit to wenchma/rabbitmq that referenced this issue Jan 12, 2015

wenchma
Add more chefspec tests
Add some missing spec tests to cover more chef resources,
but it reports some same untouched resources repeatedly
for many times.

Fixes issue rabbitmq#190
@wenchma

This comment has been minimized.

wenchma pushed a commit to wenchma/rabbitmq that referenced this issue Jan 12, 2015

wenchma
Add more chefspec tests
Add some missing spec tests to cover more chef resources,
but it reports some same untouched resources repeatedly
for many times.

Fixes issue rabbitmq#190

wenchma pushed a commit to wenchma/rabbitmq that referenced this issue Jan 12, 2015

wenchma
Add more chefspec tests
Add some missing spec tests to cover more chef resources,
but it reports some same untouched resources repeatedly
for many times.

Fixes issue rabbitmq#190

wenchma pushed a commit to wenchma/rabbitmq that referenced this issue Jan 13, 2015

wenchma
Add more chefspec tests
Add some missing spec tests to cover more chef resources,
but it reports some same untouched resources repeatedly
for many times.

Fixes issue rabbitmq#190
@wenchma

This comment has been minimized.

Copy link
Contributor

commented Jan 13, 2015

@jjasghar the new spec tests reach 100% coverage as follows:

~/rabbitmq$ rspec spec/
....................................

Finished in 1 minute 28.43 seconds (files took 4.51 seconds to load)
36 examples, 0 failures

ChefSpec Coverage report generated...

Total Resources: 23
Touched Resources: 23
Touch Coverage: 100.0%

You are awesome and so is your test coverage! Have a fantastic day!

@jjasghar

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 13, 2015

Closed so we have everything in one place.

@jjasghar jjasghar closed this Jan 13, 2015

wenchma pushed a commit to wenchma/rabbitmq that referenced this issue Feb 3, 2015

wenchma
Add more chefspec tests
Add some missing spec tests to cover more chef resources,
but it reports some same untouched resources repeatedly
for many times.

Fixes issue rabbitmq#190

wenchma pushed a commit to wenchma/rabbitmq that referenced this issue Feb 3, 2015

wenchma
Add more chefspec tests
Add some missing spec tests to cover more chef resources,
but it reports some same untouched resources repeatedly
for many times.

Fixes issue rabbitmq#190

wenchma pushed a commit to wenchma/rabbitmq that referenced this issue Feb 3, 2015

wenchma
Add more chefspec tests
Add some missing spec tests to cover more chef resources,
but it reports some same untouched resources repeatedly
for many times.

Fixes issue rabbitmq#190

wenchma pushed a commit to wenchma/rabbitmq that referenced this issue May 1, 2015

wenchma
Add more chefspec tests
Add some missing spec tests to cover more chef resources,
but it reports some same untouched resources repeatedly
for many times.

Fixes issue rabbitmq#190
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.