Skip to content
This repository was archived by the owner on Jul 14, 2021. It is now read-only.

chefdk 0.9.0-pre on Windows 10 and 2012r2 generates cookbooks that don't pass chefspec #546

Closed
pburkholder opened this issue Oct 4, 2015 · 4 comments
Labels
Milestone

Comments

@pburkholder
Copy link

As a Windows user of ChefDK
I expect to chef generate cookbook to generate a cookbook which passes rspec
Instead I get:

C:\Projects\hacks\test [master +9 ~0 -0 !]> rspec -b
F

Failures:

  1) test::default When all attributes are default, on an unspecified platform converges successfully
     Failure/Error: expect { chef_run }.to_not raise_error
       expected no Exception, got #<ArgumentError: wrong number of arguments (1 for 2)> with backtrace:
         # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.0.current.0-universal-mingw32/lib/chef/event_dispatch/base.rb:127:in `synchronized_cookbook'
         # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.0.current.0-universal-mingw32/lib/chef/event_dispatch/dispatcher.rb:36:in `call'
         # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.0.current.0-universal-mingw32/lib/chef/event_dispatch/dispatcher.rb:36:in `block in call_subscribers'
         # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.0.current.0-universal-mingw32/lib/chef/event_dispatch/dispatcher.rb:29:in `each'
         # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.0.current.0-universal-mingw32/lib/chef/event_dispatch/dispatcher.rb:29:in `call_subscribers'
         # (eval):2:in `synchronized_cookbook'
         # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.0.current.0-universal-mingw32/lib/chef/cookbook/synchronizer.rb:134:in `mark_file_synced'
         # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.0.current.0-universal-mingw32/lib/chef/cookbook/synchronizer.rb:157:in `block (3 levels) in sync_cookbooks'
         # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.0.current.0-universal-mingw32/lib/chef/cookbook/synchronizer.rb:154:in `synchronize'
         # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.0.current.0-universal-mingw32/lib/chef/cookbook/synchronizer.rb:154:in `block (2 levels) in sync_cookbooks'
         # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.0.current.0-universal-mingw32/lib/chef/util/threaded_job_queue.rb:52:in `call'
         # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.0.current.0-universal-mingw32/lib/chef/util/threaded_job_queue.rb:52:in `block (3 levels) in process'
         # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.0.current.0-universal-mingw32/lib/chef/util/threaded_job_queue.rb:50:in `loop'
         # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.0.current.0-universal-mingw32/lib/chef/util/threaded_job_queue.rb:50:in `block (2 levels) in process'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-support-3.3.0/lib/rspec/support.rb:86:in `block in <module:Support>'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-support-3.3.0/lib/rspec/support.rb:93:in `call'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-support-3.3.0/lib/rspec/support.rb:93:in `notify_failure'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-expectations-3.3.1/lib/rspec/expectations/fail_with.rb:27:in `fail_with'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-expectations-3.3.1/lib/rspec/expectations/handler.rb:40:in `handle_failure'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-expectations-3.3.1/lib/rspec/expectations/handler.rb:72:in `block in handle_matcher'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-expectations-3.3.1/lib/rspec/expectations/handler.rb:27:in `with_matcher'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-expectations-3.3.1/lib/rspec/expectations/handler.rb:70:in `handle_matcher'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-expectations-3.3.1/lib/rspec/expectations/expectation_target.rb:67:in `not_to'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-expectations-3.3.1/lib/rspec/expectations/expectation_target.rb:92:in `not_to'
     # ./spec/unit/recipes/default_spec.rb:17:in `block (3 levels) in <top (required)>'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:206:in `instance_exec'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:206:in `block in run'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:430:in `block in with_around_and_singleton_context_hooks'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:388:in `block in with_around_example_hooks'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/hooks.rb:478:in `block in run'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/hooks.rb:616:in `run_around_example_hooks_for'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/hooks.rb:478:in `run'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:388:in `with_around_example_hooks'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:430:in `with_around_and_singleton_context_hooks'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:203:in `run'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example_group.rb:559:in `block in run_examples'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example_group.rb:555:in `map'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example_group.rb:555:in `run_examples'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example_group.rb:521:in `run'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example_group.rb:522:in `block in run'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example_group.rb:522:in `map'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example_group.rb:522:in `run'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:115:in `block (3 levels) in run_specs'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:115:in `map'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:115:in `block (2 levels) in run_specs'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1627:in `with_suite_hooks'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:114:in `block in run_specs'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/reporter.rb:77:in `report'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:113:in `run_specs'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:89:in `run'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:73:in `run'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:41:in `invoke'
     # C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.3.2/exe/rspec:4:in `<top (required)>'
     # C:/opscode/chefdk/embedded/bin/rspec:23:in `load'
     # C:/opscode/chefdk/embedded/bin/rspec:23:in `<main>'

Finished in 0.59074 seconds (files took 16.19 seconds to load)
1 example, 1 failure

Failed examples:

rspec ./spec/unit/recipes/default_spec.rb:16 # test::default When all attributes are default, on an unspecified platform converges successfully

To reproduce:

  • create a fresh Windows 20012r2 from opentable/win-2012r2-standard-amd64-nocm
  • run in a Powershell Admin console:
    . { iwr -useb https://omnitruck.chef.io/install.ps1 } | iex; install -channel current -project chefdk
  • run in a regular powershell console:
c:\opscode\chefdk\bin\chef.bat | shell-init powershell | iex
chef generate cookbook test
cd test
rspec
@pburkholder
Copy link
Author

Note: Changing the rspec from ServerRunner to SoloRunner makes this go away.

@danielsdeleo
Copy link
Contributor

Is the generated code the same on windows and *nix?

@pburkholder
Copy link
Author

@danielsdeleo Yes, the generated code is identical on all platforms; it's the code from https://github.com/chef/chef-dk/blob/master/lib/chef-dk/skeletons/code_generator/templates/default/recipe_spec.rb.erb.

I came across this trying to get other work done, I won't be able to dive into why there are problems with synchronized_cookbook on Windows for at least a couple of days.

@jkeiser
Copy link
Contributor

jkeiser commented Oct 5, 2015

A few things we know so far:

  1. This does not happen on OS/X.
  2. The generator on OS/X, and the generator on Windows, generate byte-for-byte identical cookbooks. So it's not the generator.
  3. This does not happen on 12.4.3, and does happen on 12.5.0 integration builds, making it a regression and blocker.

Will file a 12.5 bug once I know a little more.

@jkeiser jkeiser added this to the 0.9.0 milestone Oct 5, 2015
@jkeiser jkeiser added the Bug label Oct 5, 2015
jkeiser added a commit to chef/chef that referenced this issue Oct 5, 2015
ksubrama pushed a commit that referenced this issue Jan 11, 2016
@thommay thommay added Type: Bug Doesn't work as expected. and removed Bug labels Feb 1, 2017
@chef-boneyard chef-boneyard locked and limited conversation to collaborators Feb 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

4 participants