Update .gitreview file for project rename

Added bootstrap.sh to allow gate to work

Change-Id: I73187d3bfaa1980cb730f01afa2fa50afb15ae31
This commit is contained in:
Jeremy Stanley 2015-06-12 22:41:19 +00:00 committed by Mark Vanderwiel
parent 563aeee922
commit 8cfa80e9cb
6 changed files with 43 additions and 99 deletions

View File

@ -1,4 +1,4 @@
[gerrit]
host=review.openstack.org
port=29418
project=stackforge/cookbook-openstack-client.git
project=openstack/cookbook-openstack-client.git

15
Gemfile
View File

@ -1,19 +1,4 @@
source 'https://rubygems.org'
gem 'chef', '~> 11.18.6'
gem 'json', '<= 1.7.7' # chef 11 dependency
gem 'berkshelf', '~> 3.2.1'
gem 'hashie', '~> 2.0'
gem 'chefspec', '~> 4.0.0'
gem 'rspec', '~> 3.0.0'
gem 'foodcritic', '~> 4.0'
gem 'rubocop', '~> 0.29.1'
gem 'chef-sugar'
gem 'fog'
gem 'rake', '~> 10.0'
gem 'test-kitchen'
gem 'kitchen-vagrant'
gem 'guard', '>= 2.6'
gem 'guard-rubocop', '>= 1.1'
gem 'guard-foodcritic', '>= 1.0.2'

View File

@ -1,14 +0,0 @@
# Guardfile for testing your chef cookbooks.
guard :rubocop do
watch(%r{.+\.rb$})
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
end
guard :foodcritic, cookbook_paths: '.', cli: ['--epic-fail', 'any'] do
watch(%r{attributes/.+\.rb$})
watch(%r{providers/.+\.rb$})
watch(%r{recipes/.+\.rb$})
watch(%r{resources/.+\.rb$})
watch(%r{metadata\.rb$})
end

View File

@ -1,77 +1,41 @@
# Encoding: utf-8
task default: ["test"]
namespace :prepare do
desc 'Install ChefDK'
task :chefdk do
begin
gem 'chef-dk', '0.3.0'
rescue Gem::LoadError
puts 'ChefDK not found. Installing it for you...'
sh %(wget -O /tmp/chefdk.deb https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/x86_64/chefdk_0.3.0-1_amd64.deb)
sh %(sudo dpkg -i /tmp/chefdk.deb)
end
end
task :bundle do
if ENV['CI']
sh %(chef exec bundle install --path=.bundle --jobs 1 --retry 3 --verbose)
else
sh %(chef exec bundle install --path .bundle)
end
end
task :berks do
sh %(chef exec berks vendor)
end
task :test => [:lint, :style, :unit]
desc "Vendor the cookbooks in the Berksfile"
task :berks_prep do
sh %{chef exec berks vendor}
end
desc 'Install required Gems and Cookbooks'
task prepare: ['prepare:bundle', 'prepare:berks']
namespace :style do
task :rubocop do
sh %(chef exec rubocop)
end
task :foodcritic do
sh %(chef exec foodcritic .)
end
desc "Get the gems installed"
task :bundle do
sh %(chef exec gem install -g)
end
desc 'Run all style checks'
task style: ['style:foodcritic', 'style:rubocop']
namespace :integration do
task :kitchen do
sh %(chef exec kitchen test)
end
desc "Run FoodCritic (lint) tests"
task :lint do
sh %{chef exec foodcritic --epic-fail any --tags ~FC003 --tags ~FC023 .}
end
task integration: ['integration:kitchen']
namespace :unit do
task :chefspec do
sh %(chef exec rspec test/unit/spec)
end
desc "Run RuboCop (style) tests"
task :style do
sh %{chef exec rubocop}
end
desc 'Run all unit tests'
task unit: ['unit:chefspec']
task spec: ['unit']
# Run all tests
desc 'Run all tests'
task test: ['style', 'unit', 'integration']
# The default rake task should just run it all
desc 'Install required Gems and Cookbook then run all tests'
task default: ['prepare', 'test']
begin
require 'kitchen/rake_tasks'
Kitchen::RakeTasks.new
rescue LoadError
puts '>>>>> Kitchen gem not loaded, omitting tasks' unless ENV['CI']
desc "Run RSpec (unit) tests"
task :unit => [:berks_prep, :bundle] do
sh %{chef exec rspec --format documentation}
end
desc "Remove the berks-cookbooks directory and the Berksfile.lock"
task :clean do
rm_rf [
'berks-cookbooks',
'Berksfile.lock'
]
end
desc "Integration test"
task :integration => [:berks_prep, :bundle] do
sh %(chef exec kitchen test)
end

9
bootstrap.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash -x
## This script is for installing all the needed packages on trusty to run the chef tests with 'chef exec rake'.
## It relies on the common bootstrap.sh from openstack/cookbook-openstack-common for installing common dependencies.
curl https://raw.githubusercontent.com/openstack/cookbook-openstack-common/master/bootstrap.sh \
--retry 3 \
--silent \
--show-error \
| /bin/bash -x

View File

@ -3,7 +3,7 @@
require_relative 'spec_helper'
describe 'openstack_client::_example_nova' 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) }
@ -17,7 +17,7 @@ describe 'openstack_client::_example_nova' do
end
describe 'openstack_client::_example_nova' 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) }
@ -31,7 +31,7 @@ describe 'openstack_client::_example_nova' do
end
describe 'openstack_client::_example_nova' 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) }