Browse Source

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
tags/kilo-eol
Jan Klare 4 years ago
parent
commit
d1400a6f23

+ 4
- 0
Gemfile View File

@@ -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
+
1 5
 source 'https://rubygems.org'
2 6
 
3 7
 gem 'chef', '~> 11.18.6'

+ 1
- 0
README.md View File

@@ -119,6 +119,7 @@ License and Author
119 119
 | **Author**           |  John Dewey (<jdewey@att.com>)                     |
120 120
 | **Author**           |  Ionut Artarisi (<iartarisi@suse.cz>)              |
121 121
 | **Author**           |  Mark Vanderwiel (<vanderwl@us.ibm.com>)           |
122
+| **Author**           |  Jan Klare (<j.klare@x-ion.de>)                    |
122 123
 |                      |                                                    |
123 124
 | **Copyright**        |  Copyright (c) 2012-2013, Rackspace US, Inc.       |
124 125
 | **Copyright**        |  Copyright (c) 2012-2013, Opscode, Inc.            |

+ 7
- 14
Rakefile View File

@@ -2,32 +2,25 @@ task default: ["test"]
2 2
 
3 3
 task :test => [:lint, :style, :unit]
4 4
 
5
-task :bundler_prep do
6
-  mkdir_p '.bundle'
7
-  sh %{bundle install --path=.bundle --jobs 1 --retry 3 --verbose}
5
+task :berks_prep do
6
+  sh %{chef exec berks vendor}
8 7
 end
9 8
 
10
-task :berks_prep => :bundler_prep do
11
-  sh %{bundle exec berks vendor}
9
+task :lint do
10
+  sh %{chef exec foodcritic --epic-fail any --tags ~FC003 --tags ~FC023 .}
12 11
 end
13 12
 
14
-task :lint => :bundler_prep do
15
-  sh %{bundle exec foodcritic --epic-fail any --tags ~FC003 --tags ~FC023 .}
16
-end
17
-
18
-task :style => :bundler_prep do
19
-  sh %{bundle exec rubocop}
13
+task :style do
14
+  sh %{chef exec rubocop}
20 15
 end
21 16
 
22 17
 task :unit => :berks_prep do
23
-  sh %{bundle exec rspec --format documentation}
18
+  sh %{chef exec rspec --format documentation}
24 19
 end
25 20
 
26 21
 task :clean do
27 22
   rm_rf [
28
-    '.bundle',
29 23
     'berks-cookbooks',
30
-    'Gemfile.lock',
31 24
     'Berksfile.lock'
32 25
   ]
33 26
 end

+ 8
- 8
TESTING.md View File

@@ -1,18 +1,18 @@
1 1
 # Testing the Cookbook #
2 2
 
3
-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).
3
+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).
4 4
 
5
-We have three test suites which you can run individually (there are three rake tasks):
5
+We have three test suites which you can run either, individually (there are three rake tasks):
6 6
 
7
-    $ rake lint
8
-    $ rake style
9
-    $ rake unit
7
+    $ chef exec rake lint
8
+    $ chef exec rake style
9
+    $ chef exec rake unit
10 10
 
11 11
 or altogether:
12 12
 
13
-    $ rake test
13
+    $ chef exec rake
14 14
 
15
-The `rake` tasks will take care of installing the needed gem dependencies and cookbooks with `berkshelf`.
15
+The `rake` tasks will take care of installing the needed cookbooks with `berkshelf`.
16 16
 
17 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 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.

+ 1
- 1
spec/client_spec.rb View File

@@ -5,7 +5,7 @@ require_relative 'spec_helper'
5 5
 describe 'openstack-ops-database::client' do
6 6
   describe 'ubuntu' do
7 7
     include_context 'database-stubs'
8
-    let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) }
8
+    let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
9 9
     let(:node) { runner.node }
10 10
     let(:chef_run) { runner.converge(described_recipe) }
11 11
 

+ 1
- 1
spec/mariadb-client-redhat_spec.rb View File

@@ -4,7 +4,7 @@ require_relative 'spec_helper'
4 4
 
5 5
 describe 'openstack-ops-database::mariadb-client' do
6 6
   describe 'suse' do
7
-    let(:runner) { ChefSpec::Runner.new(REDHAT_OPTS) }
7
+    let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
8 8
     let(:node) do
9 9
       runner.node.set['openstack']['db']['service_type'] = 'mariadb'
10 10
       runner.node

+ 1
- 1
spec/mariadb-client-suse_spec.rb View File

@@ -4,7 +4,7 @@ require_relative 'spec_helper'
4 4
 
5 5
 describe 'openstack-ops-database::mariadb-client' do
6 6
   describe 'suse' do
7
-    let(:runner) { ChefSpec::Runner.new(SUSE_OPTS) }
7
+    let(:runner) { ChefSpec::SoloRunner.new(SUSE_OPTS) }
8 8
     let(:node) do
9 9
       runner.node.set['openstack']['db']['service_type'] = 'mariadb'
10 10
       runner.node

+ 1
- 1
spec/mariadb-client_spec.rb View File

@@ -5,7 +5,7 @@ require_relative 'spec_helper'
5 5
 describe 'openstack-ops-database::mariadb-client' do
6 6
   include_context 'database-stubs'
7 7
   describe 'ubuntu' do
8
-    let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) }
8
+    let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
9 9
     let(:node) do
10 10
       runner.node.set['openstack']['db']['service_type'] = 'mariadb'
11 11
       runner.node

+ 1
- 1
spec/mariadb-server-redhat_spec.rb View File

@@ -5,7 +5,7 @@ require_relative 'spec_helper'
5 5
 describe 'openstack-ops-database::mariadb-server' do
6 6
   describe 'redhat' do
7 7
     include_context 'database-stubs'
8
-    let(:runner) { ChefSpec::Runner.new(REDHAT_OPTS) }
8
+    let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
9 9
     let(:node) { runner.node }
10 10
     let(:chef_run) { runner.converge(described_recipe) }
11 11
     let(:file) { chef_run.template('/etc/my.cnf.d/openstack.cnf') }

+ 1
- 1
spec/mariadb-server_spec.rb View File

@@ -5,7 +5,7 @@ require_relative 'spec_helper'
5 5
 describe 'openstack-ops-database::mariadb-server' do
6 6
   describe 'ubuntu' do
7 7
     include_context 'database-stubs'
8
-    let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) }
8
+    let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
9 9
     let(:node) { runner.node }
10 10
     let(:chef_run) { runner.converge(described_recipe) }
11 11
     let(:file) { chef_run.template('/etc/mysql/conf.d/openstack.cnf') }

+ 1
- 1
spec/mysql-client-suse_spec.rb View File

@@ -4,7 +4,7 @@ require_relative 'spec_helper'
4 4
 
5 5
 describe 'openstack-ops-database::mysql-client' do
6 6
   describe 'suse' do
7
-    let(:runner) { ChefSpec::Runner.new(SUSE_OPTS) }
7
+    let(:runner) { ChefSpec::SoloRunner.new(SUSE_OPTS) }
8 8
     let(:node) { runner.node }
9 9
     let(:chef_run) { runner.converge(described_recipe) }
10 10
 

+ 1
- 1
spec/mysql-client_spec.rb View File

@@ -5,7 +5,7 @@ require_relative 'spec_helper'
5 5
 describe 'openstack-ops-database::mysql-client' do
6 6
   include_context 'database-stubs'
7 7
   describe 'ubuntu' do
8
-    let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) }
8
+    let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
9 9
     let(:node) { runner.node }
10 10
     let(:chef_run) { runner.converge(described_recipe) }
11 11
 

+ 1
- 1
spec/mysql-server_spec.rb View File

@@ -5,7 +5,7 @@ require_relative 'spec_helper'
5 5
 describe 'openstack-ops-database::mysql-server' do
6 6
   describe 'ubuntu' do
7 7
     include_context 'database-stubs'
8
-    let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) }
8
+    let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
9 9
     let(:node) { runner.node }
10 10
     let(:chef_run) { runner.converge(described_recipe) }
11 11
 

+ 1
- 1
spec/openstack-db_spec.rb View File

@@ -6,7 +6,7 @@ describe 'openstack-ops-database::openstack-db' do
6 6
   include_context 'database-stubs'
7 7
 
8 8
   before do
9
-    @chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS
9
+    @chef_run = ::ChefSpec::SoloRunner.new ::UBUNTU_OPTS
10 10
   end
11 11
 
12 12
   it 'creates databases and users' do

+ 1
- 1
spec/postgresql-server_spec.rb View File

@@ -6,7 +6,7 @@ describe 'openstack-ops-database::postgresql-server' do
6 6
   describe 'ubuntu' do
7 7
     include_context 'database-stubs'
8 8
 
9
-    let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) }
9
+    let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
10 10
     let(:node) { runner.node }
11 11
     let(:chef_run) do
12 12
       # The postgresql cookbook will raise an 'uninitialized constant

+ 1
- 1
spec/server_spec.rb View File

@@ -5,7 +5,7 @@ require_relative 'spec_helper'
5 5
 describe 'openstack-ops-database::server' do
6 6
   describe 'ubuntu' do
7 7
     include_context 'database-stubs'
8
-    let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) }
8
+    let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
9 9
     let(:node) { runner.node }
10 10
     let(:chef_run) { runner.converge(described_recipe) }
11 11
 

Loading…
Cancel
Save