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

Clean up spec tests & switch to using Rake #18

Merged
merged 9 commits into from Aug 24, 2015

Conversation

Projects
None yet
2 participants
@jeffbyrnes
Contributor

jeffbyrnes commented Aug 23, 2015

  • Use Rake for testing in Travis instead of including binstubs
  • Add ChefSpec for execute[setcap …] resource
    • Requires tweaking the command stub to return false, so it is triggered
    • TODO Add additional test paths for when setcap returns true, and the other conditions that cause that execute resource to not run
  • Rubocop cleanup of spec Ruby
  • Drop unnecessary gems from Gemfile
  • Switch to using bundled rspec for Guard
    • A user could install ChefDK to a nonstandard location
    • Some of the gems necessary to test are not included in ChefDK, and bundler is the easiest way to handle installing them & using them

One thing to note, the tests will randomly pass or not pass, throwing these errors (as reported in #11):

5) VaultCookbook::Resource::VaultConfig#action_create
   Failure/Error: allow_any_instance_of(Chef::Provider).to receive(:chef_vault_item) { { 'ca_certificate' => 'foo', 'certificate' => 'bar', 'private_key' => 'baz' } }
     Chef::Provider does not implement #chef_vault_item
   # ./test/spec/libraries/vault_config_spec.rb:10:in `block (3 levels) in <top (required)>'

6) VaultCookbook::Resource::VaultConfig#action_create
   Failure/Error: allow_any_instance_of(Chef::Provider).to receive(:chef_vault_item) { { 'ca_certificate' => 'foo', 'certificate' => 'bar', 'private_key' => 'baz' } }
     Chef::Provider does not implement #chef_vault_item
   # ./test/spec/libraries/vault_config_spec.rb:10:in `block (3 levels) in <top (required)>'

jeffbyrnes added some commits Aug 19, 2015

Remove Gem binaries
These should not be here; let bundler do its thing
Remove Serverspec from Gemfile
Test Kitchen does _not_ need Serverspec in your gemfile, and ignores
it anyway. Its installation is handled via an internal mechanism.
Use bundled rspec Guard
Some of the gems needed to do Rspec tests do not come with ChefDK, so to
simplify the process of testing, we use the bundled Rspec instead of the
ChefDK version.

Additionally, someone could install ChefDK to a nonstandard path, so
this also guards against that.
Switch to using Rake for Travis tests
Cleaner than including the binstubs for the various test mechanisms

Also, omit gems for integration testing, since we don’t in Travis CI
Drop unnecessary config from .rspec
The spec_helper handles this, no need to have it twice
Cache bundled gems in Travis CI
Makes for much faster tests

johnbellone added a commit that referenced this pull request Aug 24, 2015

Merge pull request #18 from evertrue/clean_up_testing
Clean up spec tests & switch to using Rake

@johnbellone johnbellone merged commit 7665270 into sous-chefs:master Aug 24, 2015

1 check failed

continuous-integration/travis-ci/pr The Travis CI build could not complete due to an error
Details

@jeffbyrnes jeffbyrnes deleted the evertrue:clean_up_testing branch Aug 24, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment