moving from bundler to chefdk

- deprecated Gemfile
- updated Rakefile to use 'chef exec' instead of 'bundle exec'
- updated TESTING.md
- replaced Runner in specs with SoloRunner for new chefspec version
- initialized file_cache_path to make git_sync spec for docker work

Change-Id: I845c712f2d0d216d9d4a9d32c28ac4b03e96109a
This commit is contained in:
Jan Klare 2015-04-24 17:44:49 +02:00
parent 1680ba280e
commit d3a29ed8c2
35 changed files with 52 additions and 54 deletions

View File

@ -1,3 +1,7 @@
## THIS GEMFILE IS DEPRECATED AND WILL BE REMOVED AFTER THE NEXT RELEASE
## THERE WON'T BE ANY UPDATES TO THIS FILE DURING THIS RELEASE CYCLE
## WE SWITCHED TO CHEFDK AS THE BUNDLE FOR THE NEEDED GEMS
source 'https://rubygems.org'
gem 'chef', '~> 11.18.6'

View File

@ -2,32 +2,25 @@ task default: ["test"]
task :test => [:lint, :style, :unit]
task :bundler_prep do
mkdir_p '.bundle'
sh %{bundle install --path=.bundle --jobs 1 --retry 3 --verbose}
task :berks_prep do
sh %{chef exec berks vendor}
end
task :berks_prep => :bundler_prep do
sh %{bundle exec berks vendor}
task :lint do
sh %{chef exec foodcritic --epic-fail any --tags ~FC003 --tags ~FC023 .}
end
task :lint => :bundler_prep do
sh %{bundle exec foodcritic --epic-fail any --tags ~FC003 --tags ~FC023 .}
end
task :style => :bundler_prep do
sh %{bundle exec rubocop}
task :style do
sh %{chef exec rubocop}
end
task :unit => :berks_prep do
sh %{bundle exec rspec --format documentation}
sh %{chef exec rspec --format documentation}
end
task :clean do
rm_rf [
'.bundle',
'berks-cookbooks',
'Gemfile.lock',
'Berksfile.lock'
]
end

View File

@ -1,18 +1,18 @@
# Testing the Cookbook #
This cookbook uses [bundler](http://gembundler.com/) and [berkshelf](http://berkshelf.com/) to isolate dependencies. Make sure you have `ruby 1.9.x`, `bundler`, `rake`, build essentials and the header files for `gecode` installed before continuing. Make sure that you're using gecode version 3. More info [here](https://github.com/opscode/dep-selector-libgecode/tree/0bad63fea305ede624c58506423ced697dd2545e#using-a-system-gecode-instead).
This cookbook uses [chefdk](https://downloads.chef.io/chef-dk/) and [berkshelf](http://berkshelf.com/) to isolate dependencies. Make sure you have chefdk and the header files for `gecode` installed before continuing. Make sure that you're using gecode version 3. More info [here](https://github.com/opscode/dep-selector-libgecode/tree/0bad63fea305ede624c58506423ced697dd2545e#using-a-system-gecode-instead). For more detailed information on what needs to be installed, you can have a quick look into the bootstrap.sh file in this repository, which does install all the needed things to get going on ubuntu trusty. The tests defined in the Rakefile include lint, style and unit. For integration testing please refere to the [openstack-chef-repo](https://github.com/stackforge/openstack-chef-repo).
We have three test suites which you can run either, individually (there are three rake tasks):
$ rake lint
$ rake style
$ rake unit
$ chef exec rake lint
$ chef exec rake style
$ chef exec rake unit
or altogether:
$ rake test
$ chef exec rake
The `rake` tasks will take care of installing the needed gem dependencies and cookbooks with `berkshelf`.
The `rake` tasks will take care of installing the needed cookbooks with `berkshelf`.
## Rubocop ##
@ -27,4 +27,4 @@ The `rake` tasks will take care of installing the needed gem dependencies and co
## Chefspec
[ChefSpec](https://github.com/sethvargo/chefspec/) is a unit testing framework for testing Chef cookbooks. ChefSpec makes it easy to write examples and get fast feedback on cookbook changes without the need for virtual machines or cloud servers.
[ChefSpec](https://github.com/sethvargo/chefspec) is a unit testing framework for testing Chef cookbooks. ChefSpec makes it easy to write examples and get fast feedback on cookbook changes without the need for virtual machines or cloud servers.

View File

@ -4,7 +4,7 @@ require_relative 'spec_helper'
describe 'openstack-compute::api-ec2' do
describe 'redhat' do
let(:runner) { ChefSpec::Runner.new(REDHAT_OPTS) }
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
let(:node) { runner.node }
let(:chef_run) { runner.converge(described_recipe) }

View File

@ -4,7 +4,7 @@ require_relative 'spec_helper'
describe 'openstack-compute::api-ec2' do
describe 'ubuntu' do
let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) }
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
let(:chef_run) { runner.converge(described_recipe) }

View File

@ -4,7 +4,7 @@ require_relative 'spec_helper'
describe 'openstack-compute::api-metadata' do
describe 'redhat' do
let(:runner) { ChefSpec::Runner.new(REDHAT_OPTS) }
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
let(:node) { runner.node }
let(:chef_run) { runner.converge(described_recipe) }

View File

@ -4,7 +4,7 @@ require_relative 'spec_helper'
describe 'openstack-compute::api-metadata' do
describe 'ubuntu' do
let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) }
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
let(:chef_run) { runner.converge(described_recipe) }

View File

@ -4,7 +4,7 @@ require_relative 'spec_helper'
describe 'openstack-compute::api-os-compute' do
describe 'redhat' do
let(:runner) { ChefSpec::Runner.new(REDHAT_OPTS) }
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
let(:node) { runner.node }
let(:chef_run) { runner.converge(described_recipe) }

View File

@ -4,7 +4,7 @@ require_relative 'spec_helper'
describe 'openstack-compute::api-os-compute' do
describe 'ubuntu' do
let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) }
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
let(:chef_run) { runner.converge(described_recipe) }

View File

@ -5,7 +5,7 @@ describe 'openstack-compute::client' do
describe 'redhat' do
let(:runner) { ChefSpec::Runner.new(REDHAT_OPTS) }
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
let(:node) { runner.node }
let(:chef_run) do
runner.converge(described_recipe)

View File

@ -5,7 +5,7 @@ describe 'openstack-compute::client' do
describe 'ubuntu' do
let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) }
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
let(:chef_run) do
runner.converge(described_recipe)

View File

@ -4,7 +4,7 @@ require_relative 'spec_helper'
describe 'openstack-compute::compute' do
describe 'redhat' do
let(:runner) { ChefSpec::Runner.new(REDHAT_OPTS) }
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
let(:node) { runner.node }
let(:chef_run) { runner.converge(described_recipe) }

View File

@ -4,7 +4,7 @@ require_relative 'spec_helper'
describe 'openstack-compute::compute' do
describe 'suse' do
let(:runner) { ChefSpec::Runner.new(SUSE_OPTS) }
let(:runner) { ChefSpec::SoloRunner.new(SUSE_OPTS) }
let(:node) { runner.node }
let(:chef_run) { runner.converge(described_recipe) }

View File

@ -4,7 +4,7 @@ require_relative 'spec_helper'
describe 'openstack-compute::compute' do
describe 'ubuntu' do
let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) }
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
let(:chef_run) { runner.converge(described_recipe) }
@ -25,7 +25,7 @@ describe 'openstack-compute::compute' do
end
it 'does not include api-metadata recipe' do
chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS
chef_run = ::ChefSpec::SoloRunner.new ::UBUNTU_OPTS
node = chef_run.node
node.set['openstack']['compute']['enabled_apis'] = 'ec2,osapi_compute'
chef_run.converge 'openstack-compute::compute'

View File

@ -4,7 +4,7 @@ require_relative 'spec_helper'
describe 'openstack-compute::conductor' do
describe 'redhat' do
let(:runner) { ChefSpec::Runner.new(REDHAT_OPTS) }
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
let(:node) { runner.node }
let(:chef_run) { runner.converge(described_recipe) }

View File

@ -4,7 +4,7 @@ require_relative 'spec_helper'
describe 'openstack-compute::conductor' do
describe 'ubuntu' do
let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) }
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
let(:chef_run) { runner.converge(described_recipe) }

View File

@ -4,7 +4,7 @@ require_relative 'spec_helper'
describe 'openstack-compute::docker-setup' do
describe 'redhat' do
let(:runner) { ChefSpec::Runner.new(REDHAT_OPTS) }
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
let(:node) { runner.node }
let(:chef_run) { runner.converge(described_recipe) }

View File

@ -4,7 +4,7 @@ require_relative 'spec_helper'
describe 'openstack-compute::docker-setup' do
describe 'ubuntu' do
let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) }
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
let(:chef_run) { runner.converge(described_recipe) }

View File

@ -4,7 +4,7 @@ require_relative 'spec_helper'
describe 'openstack-compute::identity_registration' do
describe 'ubuntu' do
let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) }
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
let(:chef_run) { runner.converge(described_recipe) }

View File

@ -4,7 +4,7 @@ require_relative 'spec_helper'
describe 'openstack-compute::libvirt' do
describe 'redhat' do
let(:runner) { ChefSpec::Runner.new(REDHAT_OPTS) }
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
let(:node) { runner.node }
let(:chef_run) { runner.converge(described_recipe) }

View File

@ -11,7 +11,7 @@ describe 'openstack-compute::libvirt' do
end
describe 'suse' do
let(:runner) { ChefSpec::Runner.new(SUSE_OPTS) }
let(:runner) { ChefSpec::SoloRunner.new(SUSE_OPTS) }
let(:node) { runner.node }
let(:chef_run) { runner.converge(described_recipe) }

View File

@ -4,7 +4,7 @@ require_relative 'spec_helper'
describe 'openstack-compute::libvirt_rbd' do
describe 'ubuntu' do
let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) }
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
let(:chef_run) do
node.set['ceph']['config']['fsid'] = '00000000-0000-0000-0000-000000000000'

View File

@ -4,7 +4,7 @@ require_relative 'spec_helper'
describe 'openstack-compute::libvirt' do
describe 'ubuntu' do
let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) }
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
let(:chef_run) { runner.converge(described_recipe) }

View File

@ -4,7 +4,7 @@ require_relative 'spec_helper'
describe 'openstack-compute::network' do
describe 'redhat' do
let(:runner) { ChefSpec::Runner.new(REDHAT_OPTS) }
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
let(:node) { runner.node }
let(:chef_run) { runner.converge(described_recipe) }

View File

@ -4,7 +4,7 @@ require_relative 'spec_helper'
describe 'openstack-compute::network' do
describe 'ubuntu' do
let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) }
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
let(:chef_run) { runner.converge(described_recipe) }

View File

@ -4,7 +4,7 @@ require_relative 'spec_helper'
describe 'openstack-compute::nova-cert' do
describe 'redhat' do
let(:runner) { ChefSpec::Runner.new(REDHAT_OPTS) }
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
let(:node) { runner.node }
let(:chef_run) { runner.converge(described_recipe) }

View File

@ -4,7 +4,7 @@ require_relative 'spec_helper'
describe 'openstack-compute::nova-cert' do
describe 'ubuntu' do
let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) }
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
let(:chef_run) { runner.converge(described_recipe) }

View File

@ -4,7 +4,7 @@ require_relative 'spec_helper'
describe 'openstack-compute::nova-common' do
describe 'redhat' do
let(:runner) { ChefSpec::Runner.new(REDHAT_OPTS) }
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
let(:node) { runner.node }
let(:chef_run) { runner.converge(described_recipe) }

View File

@ -4,7 +4,7 @@ require_relative 'spec_helper'
describe 'openstack-compute::nova-common' do
describe 'ubuntu' do
let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) }
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
let(:chef_run) do
node.set['openstack']['mq'] = {

View File

@ -4,7 +4,7 @@ require_relative 'spec_helper'
describe 'openstack-compute::nova-setup' do
describe 'ubuntu' do
let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) }
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
let(:chef_run) { runner.converge(described_recipe) }

View File

@ -4,7 +4,7 @@ require_relative 'spec_helper'
describe 'openstack-compute::scheduler' do
describe 'redhat' do
let(:runner) { ChefSpec::Runner.new(REDHAT_OPTS) }
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
let(:node) { runner.node }
let(:chef_run) { runner.converge(described_recipe) }

View File

@ -4,7 +4,7 @@ require_relative 'spec_helper'
describe 'openstack-compute::scheduler' do
describe 'ubuntu' do
let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) }
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
let(:chef_run) { runner.converge(described_recipe) }

View File

@ -22,7 +22,8 @@ REDHAT_OPTS = {
UBUNTU_OPTS = {
platform: 'ubuntu',
version: '14.04',
log_level: LOG_LEVEL
log_level: LOG_LEVEL,
file_cache_path: Chef::Config[:file_cache_path]
}
shared_context 'compute_stubs' do

View File

@ -4,7 +4,7 @@ require_relative 'spec_helper'
describe 'openstack-compute::vncproxy' do
describe 'redhat' do
let(:runner) { ChefSpec::Runner.new(REDHAT_OPTS) }
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
let(:node) { runner.node }
let(:chef_run) { runner.converge(described_recipe) }

View File

@ -4,7 +4,7 @@ require_relative 'spec_helper'
describe 'openstack-compute::vncproxy' do
describe 'ubuntu' do
let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) }
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
let(:chef_run) { runner.converge(described_recipe) }