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

Fix webui installation spec test #305

Merged
merged 4 commits into from
Apr 19, 2016

Conversation

shortdudey123
Copy link
Contributor

Since the ConsulInstallationWebui provider relies on non-core chef resources, we can't use an inline recipe.

1) ConsulCookbook::Provider::ConsulInstallationWebui webui installation
 Failure/Error:
   it do is_expected.to unzip_zipfile('consul_0.6.4_web_ui.zip')
     .with(source: 'https://releases.hashicorp.com/consul/0.6.4/consul_0.6.4_web_ui.zip',
           path: '/opt/consul-webui/0.6.4')
   end

 NoMethodError:
   consul_installation[0.6.4] (/Users/user/github/chef-consul/test/spec/libraries/consul_installation_webui_spec.rb line 12) had an error: NoMethodError: No resource or method named `zipfile' for `ConsulCookbook::Provider::ConsulInstallationWebui ""'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/dsl/recipe.rb:102:in `rescue in method_missing'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/dsl/recipe.rb:99:in `method_missing'
 # ./libraries/consul_installation_webui.rb:50:in `block in action_create'
 # ./libraries/consul_installation_webui.rb:45:in `action_create'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/provider.rb:144:in `run_action'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/resource.rb:596:in `run_action'
 # ./.bundle/ruby/2.2.0/gems/chefspec-4.6.0/lib/chefspec/extensions/chef/resource.rb:22:in `run_action'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/runner.rb:73:in `run_action'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/runner.rb:105:in `block (2 levels) in converge'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/runner.rb:105:in `each'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/runner.rb:105:in `block in converge'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/resource_collection/resource_list.rb:84:in `block in execute_each_resource'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/resource_collection/resource_list.rb:82:in `execute_each_resource'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/runner.rb:104:in `converge'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/client.rb:668:in `block in converge'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/client.rb:663:in `catch'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/client.rb:663:in `converge'
 # ./.bundle/ruby/2.2.0/gems/chefspec-4.6.0/lib/chefspec/solo_runner.rb:126:in `converge'
 # ./test/spec/libraries/consul_installation_webui_spec.rb:17:in `block (3 levels) in <top (required)>'
 # ------------------
 # --- Caused by: ---
 # NoMethodError:
 #   undefined method `zipfile' for #<ConsulCookbook::Provider::ConsulInstallationWebui:0x007fc246a8ee80>
 #   ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/dsl/recipe.rb:100:in `method_missing'

@Ginja
Copy link
Contributor

Ginja commented Mar 23, 2016

@johnbellone @shortdudey123

This error during the CI test:

ArgumentError
-------------
Validation map has unknown check: name_property

Should be fixed with this PR johnbellone/rubyzip-cookbook#4

@shortdudey123
Copy link
Contributor Author

@Ginja thanks! i hadn't had a chance to look at that yet error yet

@johnbellone
Copy link
Contributor

I am wondering why these tests are passing locally for me. I just ran the build again for this pull-request and it threw an error about nssm[consul] not being in the resource collection. It looks like that we are guarding against that being installed a subsequent time.

@shortdudey123
Copy link
Contributor Author

@johnbellone i am guessing you have something cached

if you clone the repo again, bundle install, and test... do they pass?

@shortdudey123
Copy link
Contributor Author

This is the tests running locally for me

$ bundle exec rake unit
WARNING: Nokogiri was built against LibXML version 2.9.0, but has dynamically loaded 2.9.3
/usr/local/var/rbenv/versions/2.2.2/bin/ruby -I/Users/user/github/chef-consul/.bundle/ruby/2.2.0/gems/rspec-core-3.4.4/lib:/Users/user/github/chef-consul/.bundle/ruby/2.2.0/gems/rspec-support-3.4.1/lib /Users/user/github/chef-consul/.bundle/ruby/2.2.0/gems/rspec-core-3.4.4/exe/rspec --pattern test/spec/\*\*\{,/\*/\*\*\}/\*_spec.rb
Run options: include {:focus=>true}

All examples were filtered out; ignoring {:focus=>true}

Randomized with seed 60655
...[2016-03-23T17:22:41-07:00] WARN: Default value {"PATH"=>"/usr/local/bin:/usr/bin:/bin"} is invalid for property environment. In Chef 13 this will become an error: Option environment must be a kind of [String]!  You passed {"PATH"=>"/usr/local/bin:/usr/bin:/bin"}.. at /Users/user/github/chef-consul/.bundle/ruby/2.2.0/gems/poise-2.6.0/lib/poise/helpers/lazy_default.rb:57:in `set_or_return' at /Users/user/github/chef-consul/.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/event_dispatch/dispatcher.rb:43:in `call'
.[2016-03-23T17:22:42-07:00] WARN: Default value {"PATH"=>"/usr/local/bin:/usr/bin:/bin"} is invalid for property environment. In Chef 13 this will become an error: Option environment must be a kind of [String]!  You passed {"PATH"=>"/usr/local/bin:/usr/bin:/bin"}.. at /Users/user/github/chef-consul/.bundle/ruby/2.2.0/gems/poise-2.6.0/lib/poise/helpers/lazy_default.rb:57:in `set_or_return' at /Users/user/github/chef-consul/.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/event_dispatch/dispatcher.rb:43:in `call'
.[2016-03-23T17:22:42-07:00] WARN: Default value {"PATH"=>"/usr/local/bin:/usr/bin:/bin"} is invalid for property environment. In Chef 13 this will become an error: Option environment must be a kind of [String]!  You passed {"PATH"=>"/usr/local/bin:/usr/bin:/bin"}.. at /Users/user/github/chef-consul/.bundle/ruby/2.2.0/gems/poise-2.6.0/lib/poise/helpers/lazy_default.rb:57:in `set_or_return' at /Users/user/github/chef-consul/.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/event_dispatch/dispatcher.rb:43:in `call'
..............

Finished in 1 minute 56.46 seconds (files took 9.41 seconds to load)
19 examples, 0 failures

Randomized with seed 60655

Coverage report generated for Unit Tests to /Users/user/github/chef-consul/coverage. 3339 / 5737 LOC (58.2%) covered.
$

@shortdudey123
Copy link
Contributor Author

@johnbellone any update on this from your end? if you retrigger the travis build it should pass

Since the ConsulInstallationWebui provider relies on non-core chef resources, we can't use an inline recipe.

```
1) ConsulCookbook::Provider::ConsulInstallationWebui webui installation
 Failure/Error:
   it do is_expected.to unzip_zipfile('consul_0.6.4_web_ui.zip')
     .with(source: 'https://releases.hashicorp.com/consul/0.6.4/consul_0.6.4_web_ui.zip',
           path: '/opt/consul-webui/0.6.4')
   end

 NoMethodError:
   consul_installation[0.6.4] (/Users/user/github/chef-consul/test/spec/libraries/consul_installation_webui_spec.rb line 12) had an error: NoMethodError: No resource or method named `zipfile' for `ConsulCookbook::Provider::ConsulInstallationWebui ""'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/dsl/recipe.rb:102:in `rescue in method_missing'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/dsl/recipe.rb:99:in `method_missing'
 # ./libraries/consul_installation_webui.rb:50:in `block in action_create'
 # ./libraries/consul_installation_webui.rb:45:in `action_create'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/provider.rb:144:in `run_action'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/resource.rb:596:in `run_action'
 # ./.bundle/ruby/2.2.0/gems/chefspec-4.6.0/lib/chefspec/extensions/chef/resource.rb:22:in `run_action'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/runner.rb:73:in `run_action'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/runner.rb:105:in `block (2 levels) in converge'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/runner.rb:105:in `each'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/runner.rb:105:in `block in converge'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/resource_collection/resource_list.rb:84:in `block in execute_each_resource'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/resource_collection/resource_list.rb:82:in `execute_each_resource'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/runner.rb:104:in `converge'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/client.rb:668:in `block in converge'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/client.rb:663:in `catch'
 # ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/client.rb:663:in `converge'
 # ./.bundle/ruby/2.2.0/gems/chefspec-4.6.0/lib/chefspec/solo_runner.rb:126:in `converge'
 # ./test/spec/libraries/consul_installation_webui_spec.rb:17:in `block (3 levels) in <top (required)>'
 # ------------------
 # --- Caused by: ---
 # NoMethodError:
 #   undefined method `zipfile' for #<ConsulCookbook::Provider::ConsulInstallationWebui:0x007fc246a8ee80>
 #   ./.bundle/ruby/2.2.0/gems/chef-12.8.1/lib/chef/dsl/recipe.rb:100:in `method_missing'
```
@shortdudey123 shortdudey123 force-pushed the fix_webui_spec_test branch 3 times, most recently from 917ce18 to 02e12e2 Compare April 18, 2016 18:35
@codecov-io
Copy link

Current coverage is 58.79%

Merging #305 into master will increase coverage by +9.58% as of be0e581

@@            master    #305   diff @@
======================================
  Files            7       9     +2
  Stmts          380     381     +1
  Branches         0       0       
  Methods          0       0       
======================================
+ Hit            187     224    +37
  Partial          0       0       
+ Missed         193     157    -36

Review entire Coverage Diff as of be0e581

Powered by Codecov. Updated on successful CI builds.

@shortdudey123 shortdudey123 force-pushed the fix_webui_spec_test branch 4 times, most recently from 3d25e7c to 6e48653 Compare April 18, 2016 22:00
The poise inversion system needs to be added to consul_service otherwise windows tests will not pass
@shortdudey123
Copy link
Contributor Author

@johnbellone web ui tests pass correctly now, windows ones need a bit more changes to pass so i thought i would let you handle part of that to your liking

@johnbellone johnbellone merged commit 37a82ac into sous-chefs:master Apr 19, 2016
@shortdudey123 shortdudey123 deleted the fix_webui_spec_test branch April 19, 2016 01:45
@lock
Copy link

lock bot commented Apr 25, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants