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

(Modules 3391) remove rake test and fix failing test #35

Conversation

MosesMendoza
Copy link

The bundle exec rake test command in the chocolatey Rakefile runs an incomplete set of tests with a missing dependency on bundle exec rake spec_prep. After further investigation, it turns out puppetlabs_spec_helper defines rake spec which runs all the spec tests and does appropriate prep setup/teardown. After discussing with @glennsarti and @ThoughtCrhyme it seems like the correct call here is to run bundle exec rake spec instead of extending bundle exec rake test to further duplicate it.

This PR specifically just removes the rake test task from Rakefile to avoid further confusion. It is believed that since the module is pre-1.0 this change, which might be considered backwards-incompatible is acceptable. I'm happy to work up something more backwards-compatible via task redirection if we think that's appropriate.

This PR also resolves a failing test:

Mocha::ExpectationError:
unexpected invocation: #<AnyInstance:Win32::Registry>.[]('Domain')
satisfied expectations:
- allowed any number of times, invoked 4 times: #<AnyInstance:Win32::Registry>.[]('ChocolateyInstall')
- allowed any number of times, not yet invoked: #<Puppet::Util::Feature:0x45b5be0>.root?(any_parameters)

This is because facter fact(s) were making a call to Win32::Registry.[] which hadn't been stubbed (two, in fact). This commit adds these stubs to the spec_helper in addition to the existing one. This makes test pass, but may be more brittle than a more generic stub that doesn't specify the parameter. I assume we prefer higher specificity, but I'm happy to revise to a single line with just Win32::Registry.any_instance.stubs(:[]) if preferred.

Signed-off-by: Moses Mendoza [email protected]

The bundle exec rake test command in the chocolatey Rakefile runs an incomplete
set of tests with a missing dependency on bundle exec rake spec_prep. After
further investigation, it turns out puppetlabs_spec_helper defines rake spec
which runs all the spec tests and does appropriate prep setup/teardown. After
discussing with @glennsarti and @ThoughtCrhyme it seems like the correct call
here is to run bundle exec rake spec instead of extending bundle exec rake test
to further duplicate it.

This commit specifically just removes the `rake test` task from Rakefile to
avoid further confusion. It is believed that since the module is pre-1.0 this
change, which might be considered backwards-incompatible is acceptable.

Signed-off-by: Moses Mendoza <[email protected]>
Prior to this commit a test in the config_spec was failing with:

Mocha::ExpectationError:
unexpected invocation: #<AnyInstance:Win32::Registry>.[]('Domain')
satisfied expectations:
- allowed any number of times, invoked 4 times:
  #<AnyInstance:Win32::Registry>.[]('ChocolateyInstall')
- allowed any number of times, not yet invoked:
  #<Puppet::Util::Feature:0x45b5be0>.root?(any_parameters)

This is because a facter fact was making a call to Win32::Registry.[] which
hadn't been stubbed (two, in fact). This commit adds these stubs to the
spec_helper in addition to the existing one. This commit makes test pass, but
may be more brittle than a more generic stub that doesn't specify the
parameter. This commit assumes the specificity is of higher value.

Signed-off-by: Moses Mendoza <[email protected]>
@MosesMendoza
Copy link
Author

Note: this depends on https://github.com/puppetlabs/ci-job-configs/pull/1530. That PR should be merged first to avoid CI breakage

@MosesMendoza MosesMendoza changed the title Modules 3391/master/remove rake test (Modules 339) remove rake test and fix failing test Jul 26, 2016
@MosesMendoza MosesMendoza changed the title (Modules 339) remove rake test and fix failing test (Modules 3391) remove rake test and fix failing test Jul 26, 2016
@ferventcoder
Copy link

👍 merge when CI config is merged.

@ferventcoder ferventcoder merged commit d3e1c25 into puppetlabs:master Jul 27, 2016
@ferventcoder
Copy link

Supersedes #32

ThoughtCrhyme pushed a commit to ThoughtCrhyme/puppetlabs-chocolatey that referenced this pull request Mar 20, 2017
Adding initial version of vmfloaty module for laptop puppetisation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants