[chef] RE: ChefDK and rake


Chronological Thread 
  • From: Martin Smith < >
  • To: " " < >
  • Subject: [chef] RE: ChefDK and rake
  • Date: Fri, 15 Aug 2014 18:40:12 +0000
  • Accept-language: en-US

Hi Booker,

ChefDK is new enough that I'm not sure what the 'ChefDK' way is. But I'd use bundler and a Gemfile in your project, so that all your gems (rspec, etc) are using the same Gem versions.

I did find this bug:
https://github.com/opscode/chef-dk/issues/18

That suggests you may be able to do 'chef run rake' or something like that and get the same rake+rspec you get from running rspec yourself. Or get the chef paths and hooks in front of your rake command by running -- eval "$(chef shell-init bash)" -- I haven't tested that, though. It sounds like down the road they plan on wrapping all that with a 'chef test' command, too.

Hope this helps,

Martin B. Smith, "> | 800-961-4454
5000 Walzem Rd. | San Antonio, TX  78218

Rackspace - the open cloud company
Ask about our DevOps Automation Service - www.rackspace.com/devops


From: Booker Bense
Sent: Friday, August 15, 2014 11:39 AM
To:
Subject: [chef] ChefDK and rake

I'm testing a cookbook I set up with mis using the ChefDK environment. 

I have done chef shell-init  and 
which  rspec returns 

/opt/chefdk/embedded/bin/rspec

This command runs the chefspec tests. 

chef exec rspec test/unit/spec

However this rake task fails with error suggesting it's using the wrong rspec

require 'rspec/core/rake_task'
desc 'Run ChefSpec unit tests'
RSpec::Core::RakeTask.new(:spec) do |t, _args|
  t.rspec_opts = 'test/unit/spec'
end

Is there something obvious I'm missing to make this work? 

- Booker C. Bense



Archive powered by MHonArc 2.6.16.

§