summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Klare <j.klare@x-ion.de>2015-04-29 10:29:08 +0200
committerJan Klare <j.klare@x-ion.de>2015-04-29 10:29:08 +0200
commitd1400a6f2318b4624dbbd9fcda60fd3dbeefc175 (patch)
tree8b3b76d1bb349d5870e188e5bdd6aa32379f791c
parent2d742be58dd4a550a57362729f6e62fba4cae619 (diff)
move from bundler to chefdk
- deprecated Gemfile - updated TESTING and README - updated Rakefile to use chef exec instead of bundle exec - replaced Runner by SoloRunner in specs Change-Id: I2f2bf3e1f193cb43498d0d10da8500ff59a6f5aa
Notes
Notes (review): Verified+2: Jenkins Code-Review+2: Mark Vanderwiel <vanderwl@us.ibm.com> Workflow+1: JJ Asghar <jj@getchef.com> Submitted-by: Jenkins Submitted-at: Wed, 29 Apr 2015 17:37:56 +0000 Reviewed-on: https://review.openstack.org/178553 Project: stackforge/cookbook-openstack-ops-database Branch: refs/heads/master
-rw-r--r--Gemfile4
-rw-r--r--README.md1
-rw-r--r--Rakefile21
-rw-r--r--TESTING.md16
-rw-r--r--spec/client_spec.rb2
-rw-r--r--spec/mariadb-client-redhat_spec.rb2
-rw-r--r--spec/mariadb-client-suse_spec.rb2
-rw-r--r--spec/mariadb-client_spec.rb2
-rw-r--r--spec/mariadb-server-redhat_spec.rb2
-rw-r--r--spec/mariadb-server_spec.rb2
-rw-r--r--spec/mysql-client-suse_spec.rb2
-rw-r--r--spec/mysql-client_spec.rb2
-rw-r--r--spec/mysql-server_spec.rb2
-rw-r--r--spec/openstack-db_spec.rb2
-rw-r--r--spec/postgresql-server_spec.rb2
-rw-r--r--spec/server_spec.rb2
16 files changed, 32 insertions, 34 deletions
diff --git a/Gemfile b/Gemfile
index 1299374..31c90b5 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,3 +1,7 @@
1## THIS GEMFILE IS DEPRECATED AND WILL BE REMOVED AFTER THE NEXT RELEASE
2## THERE WON'T BE ANY UPDATES TO THIS FILE DURING THIS RELEASE CYCLE
3## WE SWITCHED TO CHEFDK AS THE BUNDLE FOR THE NEEDED GEMS
4
1source 'https://rubygems.org' 5source 'https://rubygems.org'
2 6
3gem 'chef', '~> 11.18.6' 7gem 'chef', '~> 11.18.6'
diff --git a/README.md b/README.md
index fea2f27..7349ba9 100644
--- a/README.md
+++ b/README.md
@@ -119,6 +119,7 @@ License and Author
119| **Author** | John Dewey (<jdewey@att.com>) | 119| **Author** | John Dewey (<jdewey@att.com>) |
120| **Author** | Ionut Artarisi (<iartarisi@suse.cz>) | 120| **Author** | Ionut Artarisi (<iartarisi@suse.cz>) |
121| **Author** | Mark Vanderwiel (<vanderwl@us.ibm.com>) | 121| **Author** | Mark Vanderwiel (<vanderwl@us.ibm.com>) |
122| **Author** | Jan Klare (<j.klare@x-ion.de>) |
122| | | 123| | |
123| **Copyright** | Copyright (c) 2012-2013, Rackspace US, Inc. | 124| **Copyright** | Copyright (c) 2012-2013, Rackspace US, Inc. |
124| **Copyright** | Copyright (c) 2012-2013, Opscode, Inc. | 125| **Copyright** | Copyright (c) 2012-2013, Opscode, Inc. |
diff --git a/Rakefile b/Rakefile
index e9952df..357a6c0 100644
--- a/Rakefile
+++ b/Rakefile
@@ -2,32 +2,25 @@ task default: ["test"]
2 2
3task :test => [:lint, :style, :unit] 3task :test => [:lint, :style, :unit]
4 4
5task :bundler_prep do 5task :berks_prep do
6 mkdir_p '.bundle' 6 sh %{chef exec berks vendor}
7 sh %{bundle install --path=.bundle --jobs 1 --retry 3 --verbose}
8end 7end
9 8
10task :berks_prep => :bundler_prep do 9task :lint do
11 sh %{bundle exec berks vendor} 10 sh %{chef exec foodcritic --epic-fail any --tags ~FC003 --tags ~FC023 .}
12end 11end
13 12
14task :lint => :bundler_prep do 13task :style do
15 sh %{bundle exec foodcritic --epic-fail any --tags ~FC003 --tags ~FC023 .} 14 sh %{chef exec rubocop}
16end
17
18task :style => :bundler_prep do
19 sh %{bundle exec rubocop}
20end 15end
21 16
22task :unit => :berks_prep do 17task :unit => :berks_prep do
23 sh %{bundle exec rspec --format documentation} 18 sh %{chef exec rspec --format documentation}
24end 19end
25 20
26task :clean do 21task :clean do
27 rm_rf [ 22 rm_rf [
28 '.bundle',
29 'berks-cookbooks', 23 'berks-cookbooks',
30 'Gemfile.lock',
31 'Berksfile.lock' 24 'Berksfile.lock'
32 ] 25 ]
33end 26end
diff --git a/TESTING.md b/TESTING.md
index fa2e9c1..d9a964d 100644
--- a/TESTING.md
+++ b/TESTING.md
@@ -1,18 +1,18 @@
1# Testing the Cookbook # 1# Testing the Cookbook #
2 2
3This 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). 3This 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).
4 4
5We have three test suites which you can run individually (there are three rake tasks): 5We have three test suites which you can run either, individually (there are three rake tasks):
6 6
7 $ rake lint 7 $ chef exec rake lint
8 $ rake style 8 $ chef exec rake style
9 $ rake unit 9 $ chef exec rake unit
10 10
11or altogether: 11or altogether:
12 12
13 $ rake test 13 $ chef exec rake
14 14
15The `rake` tasks will take care of installing the needed gem dependencies and cookbooks with `berkshelf`. 15The `rake` tasks will take care of installing the needed cookbooks with `berkshelf`.
16 16
17## Rubocop ## 17## Rubocop ##
18 18
@@ -27,4 +27,4 @@ The `rake` tasks will take care of installing the needed gem dependencies and co
27 27
28## Chefspec 28## Chefspec
29 29
30[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. 30[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.
diff --git a/spec/client_spec.rb b/spec/client_spec.rb
index a899725..b38b585 100644
--- a/spec/client_spec.rb
+++ b/spec/client_spec.rb
@@ -5,7 +5,7 @@ require_relative 'spec_helper'
5describe 'openstack-ops-database::client' do 5describe 'openstack-ops-database::client' do
6 describe 'ubuntu' do 6 describe 'ubuntu' do
7 include_context 'database-stubs' 7 include_context 'database-stubs'
8 let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) } 8 let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
9 let(:node) { runner.node } 9 let(:node) { runner.node }
10 let(:chef_run) { runner.converge(described_recipe) } 10 let(:chef_run) { runner.converge(described_recipe) }
11 11
diff --git a/spec/mariadb-client-redhat_spec.rb b/spec/mariadb-client-redhat_spec.rb
index 367a51d..9afe920 100644
--- a/spec/mariadb-client-redhat_spec.rb
+++ b/spec/mariadb-client-redhat_spec.rb
@@ -4,7 +4,7 @@ require_relative 'spec_helper'
4 4
5describe 'openstack-ops-database::mariadb-client' do 5describe 'openstack-ops-database::mariadb-client' do
6 describe 'suse' do 6 describe 'suse' do
7 let(:runner) { ChefSpec::Runner.new(REDHAT_OPTS) } 7 let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
8 let(:node) do 8 let(:node) do
9 runner.node.set['openstack']['db']['service_type'] = 'mariadb' 9 runner.node.set['openstack']['db']['service_type'] = 'mariadb'
10 runner.node 10 runner.node
diff --git a/spec/mariadb-client-suse_spec.rb b/spec/mariadb-client-suse_spec.rb
index 0a0ea4f..e3917d9 100644
--- a/spec/mariadb-client-suse_spec.rb
+++ b/spec/mariadb-client-suse_spec.rb
@@ -4,7 +4,7 @@ require_relative 'spec_helper'
4 4
5describe 'openstack-ops-database::mariadb-client' do 5describe 'openstack-ops-database::mariadb-client' do
6 describe 'suse' do 6 describe 'suse' do
7 let(:runner) { ChefSpec::Runner.new(SUSE_OPTS) } 7 let(:runner) { ChefSpec::SoloRunner.new(SUSE_OPTS) }
8 let(:node) do 8 let(:node) do
9 runner.node.set['openstack']['db']['service_type'] = 'mariadb' 9 runner.node.set['openstack']['db']['service_type'] = 'mariadb'
10 runner.node 10 runner.node
diff --git a/spec/mariadb-client_spec.rb b/spec/mariadb-client_spec.rb
index 7976c94..1380c8d 100644
--- a/spec/mariadb-client_spec.rb
+++ b/spec/mariadb-client_spec.rb
@@ -5,7 +5,7 @@ require_relative 'spec_helper'
5describe 'openstack-ops-database::mariadb-client' do 5describe 'openstack-ops-database::mariadb-client' do
6 include_context 'database-stubs' 6 include_context 'database-stubs'
7 describe 'ubuntu' do 7 describe 'ubuntu' do
8 let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) } 8 let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
9 let(:node) do 9 let(:node) do
10 runner.node.set['openstack']['db']['service_type'] = 'mariadb' 10 runner.node.set['openstack']['db']['service_type'] = 'mariadb'
11 runner.node 11 runner.node
diff --git a/spec/mariadb-server-redhat_spec.rb b/spec/mariadb-server-redhat_spec.rb
index f353164..38b17eb 100644
--- a/spec/mariadb-server-redhat_spec.rb
+++ b/spec/mariadb-server-redhat_spec.rb
@@ -5,7 +5,7 @@ require_relative 'spec_helper'
5describe 'openstack-ops-database::mariadb-server' do 5describe 'openstack-ops-database::mariadb-server' do
6 describe 'redhat' do 6 describe 'redhat' do
7 include_context 'database-stubs' 7 include_context 'database-stubs'
8 let(:runner) { ChefSpec::Runner.new(REDHAT_OPTS) } 8 let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
9 let(:node) { runner.node } 9 let(:node) { runner.node }
10 let(:chef_run) { runner.converge(described_recipe) } 10 let(:chef_run) { runner.converge(described_recipe) }
11 let(:file) { chef_run.template('/etc/my.cnf.d/openstack.cnf') } 11 let(:file) { chef_run.template('/etc/my.cnf.d/openstack.cnf') }
diff --git a/spec/mariadb-server_spec.rb b/spec/mariadb-server_spec.rb
index fa8544c..08812bd 100644
--- a/spec/mariadb-server_spec.rb
+++ b/spec/mariadb-server_spec.rb
@@ -5,7 +5,7 @@ require_relative 'spec_helper'
5describe 'openstack-ops-database::mariadb-server' do 5describe 'openstack-ops-database::mariadb-server' do
6 describe 'ubuntu' do 6 describe 'ubuntu' do
7 include_context 'database-stubs' 7 include_context 'database-stubs'
8 let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) } 8 let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
9 let(:node) { runner.node } 9 let(:node) { runner.node }
10 let(:chef_run) { runner.converge(described_recipe) } 10 let(:chef_run) { runner.converge(described_recipe) }
11 let(:file) { chef_run.template('/etc/mysql/conf.d/openstack.cnf') } 11 let(:file) { chef_run.template('/etc/mysql/conf.d/openstack.cnf') }
diff --git a/spec/mysql-client-suse_spec.rb b/spec/mysql-client-suse_spec.rb
index 89f3983..af43fb7 100644
--- a/spec/mysql-client-suse_spec.rb
+++ b/spec/mysql-client-suse_spec.rb
@@ -4,7 +4,7 @@ require_relative 'spec_helper'
4 4
5describe 'openstack-ops-database::mysql-client' do 5describe 'openstack-ops-database::mysql-client' do
6 describe 'suse' do 6 describe 'suse' do
7 let(:runner) { ChefSpec::Runner.new(SUSE_OPTS) } 7 let(:runner) { ChefSpec::SoloRunner.new(SUSE_OPTS) }
8 let(:node) { runner.node } 8 let(:node) { runner.node }
9 let(:chef_run) { runner.converge(described_recipe) } 9 let(:chef_run) { runner.converge(described_recipe) }
10 10
diff --git a/spec/mysql-client_spec.rb b/spec/mysql-client_spec.rb
index 85b8c90..86bc0d9 100644
--- a/spec/mysql-client_spec.rb
+++ b/spec/mysql-client_spec.rb
@@ -5,7 +5,7 @@ require_relative 'spec_helper'
5describe 'openstack-ops-database::mysql-client' do 5describe 'openstack-ops-database::mysql-client' do
6 include_context 'database-stubs' 6 include_context 'database-stubs'
7 describe 'ubuntu' do 7 describe 'ubuntu' do
8 let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) } 8 let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
9 let(:node) { runner.node } 9 let(:node) { runner.node }
10 let(:chef_run) { runner.converge(described_recipe) } 10 let(:chef_run) { runner.converge(described_recipe) }
11 11
diff --git a/spec/mysql-server_spec.rb b/spec/mysql-server_spec.rb
index f60cfbc..4c7a7e7 100644
--- a/spec/mysql-server_spec.rb
+++ b/spec/mysql-server_spec.rb
@@ -5,7 +5,7 @@ require_relative 'spec_helper'
5describe 'openstack-ops-database::mysql-server' do 5describe 'openstack-ops-database::mysql-server' do
6 describe 'ubuntu' do 6 describe 'ubuntu' do
7 include_context 'database-stubs' 7 include_context 'database-stubs'
8 let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) } 8 let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
9 let(:node) { runner.node } 9 let(:node) { runner.node }
10 let(:chef_run) { runner.converge(described_recipe) } 10 let(:chef_run) { runner.converge(described_recipe) }
11 11
diff --git a/spec/openstack-db_spec.rb b/spec/openstack-db_spec.rb
index e4046bc..e3ce20d 100644
--- a/spec/openstack-db_spec.rb
+++ b/spec/openstack-db_spec.rb
@@ -6,7 +6,7 @@ describe 'openstack-ops-database::openstack-db' do
6 include_context 'database-stubs' 6 include_context 'database-stubs'
7 7
8 before do 8 before do
9 @chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS 9 @chef_run = ::ChefSpec::SoloRunner.new ::UBUNTU_OPTS
10 end 10 end
11 11
12 it 'creates databases and users' do 12 it 'creates databases and users' do
diff --git a/spec/postgresql-server_spec.rb b/spec/postgresql-server_spec.rb
index 048dba2..7fe527a 100644
--- a/spec/postgresql-server_spec.rb
+++ b/spec/postgresql-server_spec.rb
@@ -6,7 +6,7 @@ describe 'openstack-ops-database::postgresql-server' do
6 describe 'ubuntu' do 6 describe 'ubuntu' do
7 include_context 'database-stubs' 7 include_context 'database-stubs'
8 8
9 let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) } 9 let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
10 let(:node) { runner.node } 10 let(:node) { runner.node }
11 let(:chef_run) do 11 let(:chef_run) do
12 # The postgresql cookbook will raise an 'uninitialized constant 12 # The postgresql cookbook will raise an 'uninitialized constant
diff --git a/spec/server_spec.rb b/spec/server_spec.rb
index a22f0d4..ea1cb3d 100644
--- a/spec/server_spec.rb
+++ b/spec/server_spec.rb
@@ -5,7 +5,7 @@ require_relative 'spec_helper'
5describe 'openstack-ops-database::server' do 5describe 'openstack-ops-database::server' do
6 describe 'ubuntu' do 6 describe 'ubuntu' do
7 include_context 'database-stubs' 7 include_context 'database-stubs'
8 let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) } 8 let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
9 let(:node) { runner.node } 9 let(:node) { runner.node }
10 let(:chef_run) { runner.converge(described_recipe) } 10 let(:chef_run) { runner.converge(described_recipe) }
11 11