-
-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Test Kitchen, ChefSpec, RuboCop, and Foodcritic on Travis CI
Signed-off-by: Seth Vargo <[email protected]>
- Loading branch information
Showing
33 changed files
with
346 additions
and
318 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,21 @@ | ||
.vagrant | ||
Berksfile.lock | ||
Gemfile.lock | ||
*~ | ||
*# | ||
.#* | ||
\#*# | ||
.*.sw[a-z] | ||
*.un~ | ||
.bundle | ||
.cache | ||
.kitchen | ||
bin | ||
*.tmp | ||
*.bk | ||
*.bkup | ||
.kitchen.local.yml | ||
Berksfile.lock | ||
Gemfile.lock | ||
|
||
.bundle/ | ||
.cache/ | ||
.kitchen/ | ||
.vagrant/ | ||
.vagrant.d/ | ||
bin/ | ||
tmp/ | ||
vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,20 @@ | ||
driver_plugin: vagrant | ||
driver_config: | ||
require_chef_omnibus: true | ||
customize: | ||
memory: 1024 | ||
|
||
platforms: | ||
- name: ubuntu-12.04 | ||
run_list: | ||
- recipe[apt::default] | ||
- name: ubuntu-10.04 | ||
run_list: | ||
- recipe[apt::default] | ||
- recipe[apt::default] | ||
- name: centos-6.4 | ||
- name: centos-5.9 | ||
|
||
suites: | ||
- name: default | ||
run_list: | ||
- recipe[logrotate_test::default] | ||
- recipe[minitest-handler::default] | ||
- recipe[logrotate::default] | ||
- name: definition | ||
run_list: | ||
- recipe[fake::definition] | ||
- name: global | ||
run_list: | ||
- recipe[logrotate::global] | ||
- recipe[minitest-handler::default] | ||
- name: definition | ||
run_list: | ||
- recipe[logrotate_test::logrotate_app] | ||
- recipe[minitest-handler::default] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
AllCops: | ||
Excludes: | ||
- vendor/** | ||
|
||
AlignParameters: | ||
Enabled: false | ||
Encoding: | ||
Enabled: false | ||
HashSyntax: | ||
Enabled: false | ||
LineLength: | ||
Enabled: false | ||
MethodLength: | ||
Max: 30 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
rvm: | ||
- 1.9.3 | ||
- 2.0.0 | ||
before_script: | ||
- bundle exec berks install | ||
script: | ||
- bundle exec foodcritic -f any . --tags ~FC015 | ||
- bundle exec rspec --color --format progress | ||
- bundle exec rubocop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'berkshelf', '~> 2.0' | ||
gem 'chefspec', '~> 2.0' | ||
gem 'foodcritic', '~> 3.0' | ||
gem 'rubocop', '~> 0.12' | ||
|
||
group :integration do | ||
gem 'test-kitchen', '~> 1.0.0.beta' | ||
gem 'kitchen-vagrant', '~> 0.11' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,53 @@ | ||
This cookbook includes support for running tests via Test Kitchen (1.0). This has some requirements. | ||
This cookbook uses a variety of testing components: | ||
|
||
1. You must be using the Git repository, rather than the downloaded cookbook from the Chef Community Site. | ||
2. You must have Vagrant 1.1 installed. | ||
3. You must have a "sane" Ruby 1.9.3 environment. | ||
- Unit tests: [ChefSpec](https://github.com/acrmp/chefspec) | ||
- Integration tests: [Test Kitchen](https://github.com/opscode/test-kitchen) | ||
- Chef Style lints: [Foodcritic](https://github.com/acrmp/foodcritic) | ||
- Ruby Style lints: [Rubocop](https://github.com/bbatsov/rubocop) | ||
|
||
Once the above requirements are met, install the additional requirements: | ||
|
||
Install the berkshelf plugin for vagrant, and berkshelf to your local Ruby environment. | ||
Prerequisites | ||
------------- | ||
To develop on this cookbook, you must have a sane Ruby 1.9+ environment. Given the nature of this installation process (and it's variance across multiple operating systems), we will leave this installation process to the user. | ||
|
||
vagrant plugin install vagrant-berkshelf | ||
gem install berkshelf | ||
You must also have `bundler` installed: | ||
|
||
Install Test Kitchen 1.0 (unreleased yet, use the alpha / prerelease version). | ||
$ gem install bundler | ||
|
||
gem install test-kitchen --pre | ||
You must also have Vagrant and VirtualBox installed: | ||
|
||
Install the Vagrant driver for Test Kitchen. | ||
- [Vagrant](https://vagrantup.com) | ||
- [VirtualBox](https://virtualbox.org) | ||
|
||
gem install kitchen-vagrant | ||
Once installed, you must install the `vagrant-berkshelf` plugin: | ||
|
||
Once the above are installed, you should be able to run Test Kitchen: | ||
$ vagrant plugin install vagrant-berkshelf | ||
|
||
kitchen list | ||
kitchen test | ||
|
||
Development | ||
----------- | ||
1. Clone the git repository from GitHub: | ||
|
||
$ git clone [email protected]:opscode-cookbooks/COOKBOOK.git | ||
|
||
2. Install the dependencies using bundler: | ||
|
||
$ bundle install | ||
|
||
3. Create a branch for your changes: | ||
|
||
$ git checkout -b my_bug_fix | ||
|
||
4. Make any changes | ||
5. Write tests to support those changes. It is highly recommended you write both unit and integration tests. | ||
6. Run the tests: | ||
- `bundle exec rspec` | ||
- `bundle exec foodcritic .` | ||
- `bundle exec rubocop` | ||
- `bundle exec kitchen test` | ||
|
||
7. Assuming the tests pass, open a Pull Request on GitHub | ||
8. Open a JIRA ticket for this compontent, linking the JIRA ticket to the Pull Request and visa versa. | ||
9. Mark the JIRA ticket as "Fix Provided" | ||
|
||
For more information, see [Opscode's Contribution Guidelines](https://wiki.opscode.com/display/chef/How+to+Contribute). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
name "logrotate" | ||
maintainer "Opscode, Inc." | ||
maintainer_email "[email protected]" | ||
license "Apache 2.0" | ||
description "Installs logrotate package and provides a definition for logrotate configs" | ||
name 'logrotate' | ||
maintainer 'Opscode, Inc.' | ||
maintainer_email '[email protected]' | ||
license 'Apache 2.0' | ||
description 'Installs logrotate package and provides a definition for logrotate configs' | ||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) | ||
version "1.3.1" | ||
version '1.3.1' | ||
|
||
recipe "logrotate", "Installs logrotate package" | ||
provides "logrotate_app" | ||
recipe 'logrotate', 'Installs logrotate package' | ||
provides 'logrotate_app' | ||
|
||
%w{ redhat centos debian ubuntu scientific amazon fedora }.each do |os| | ||
supports os | ||
end | ||
supports 'amazon' | ||
supports 'centos' | ||
supports 'debian' | ||
supports 'fedora' | ||
supports 'redhat' | ||
supports 'scientific' | ||
supports 'ubuntu' |
Oops, something went wrong.