forked from djoos-cookbooks/newrelic
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Syntax/lint checks / unit tests / integration tests
- Loading branch information
Showing
9 changed files
with
262 additions
and
90 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,19 +1,19 @@ | ||
.vagrant | ||
Vagrantfile | ||
|
||
Berksfile.lock | ||
*~ | ||
*# | ||
.#* | ||
\#*# | ||
.*.sw[a-z] | ||
*.un~ | ||
/cookbooks | ||
|
||
# Bundler | ||
cookbooks | ||
.coverage | ||
spec | ||
|
||
Berksfile.lock | ||
Gemfile.lock | ||
.vagrant | ||
Vagrantfile | ||
bin/* | ||
.bundle/* | ||
|
||
.kitchen | ||
.kitchen.local.yml |
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,56 +1,67 @@ | ||
--- | ||
driver_plugin: vagrant | ||
driver_config: | ||
require_chef_omnibus: true | ||
|
||
platforms: | ||
- name: ubuntu-12.04 | ||
driver_config: | ||
box: opscode-ubuntu-12.04 | ||
box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_provisionerless.box | ||
# - name: ubuntu-13.04 | ||
# driver_config: | ||
# box: opscode-ubuntu-13.04 | ||
# box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-13.04_provisionerless.box | ||
# - name: centos-6.3 | ||
# driver_config: | ||
# box: opscode-centos-6.3 | ||
# box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_centos-6.3_provisionerless.box | ||
- name: centos-6.4 | ||
driver_config: | ||
box: opscode-centos-6.4 | ||
box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_centos-6.4_provisionerless.box | ||
|
||
suites: | ||
- name: default | ||
run_list: | ||
- recipe[newrelic::default] | ||
attributes: | ||
newrelic: | ||
service_notify_action: nothing | ||
service_actions: | ||
- nothing | ||
# - name: dotnet-agent | ||
# run_list: | ||
# - recipe[newrelic::default] | ||
# - recipe[newrelic::dotnet-agent] | ||
# - name: java-agent | ||
# run_list: | ||
# - recipe[newrelic::default] | ||
# - recipe[newrelic::java-agent] | ||
# - name: nodejs-agent | ||
# run_list: | ||
# - recipe[newrelic::default] | ||
# - recipe[newrelic::nodejs-agent] | ||
# - name: php-agent | ||
# run_list: | ||
# - recipe[newrelic::default] | ||
# - recipe[newrelic::php-agent] | ||
# - name: python-agent | ||
# run_list: | ||
# - recipe[newrelic::default] | ||
# - recipe[newrelic::python-agent] | ||
# - name: meetme-plugin | ||
# run_list: | ||
# - recipe[newrelic::default] | ||
# - recipe[newrelic::meetme-plugin] | ||
--- | ||
driver_plugin: vagrant | ||
driver_config: | ||
require_chef_omnibus: true | ||
|
||
platforms: | ||
- name: ubuntu-12.04 | ||
driver_config: | ||
box: opscode-ubuntu-12.04 | ||
box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_provisionerless.box | ||
# - name: ubuntu-13.04 | ||
# driver_config: | ||
# box: opscode-ubuntu-13.04 | ||
# box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-13.04_provisionerless.box | ||
# - name: centos-6.3 | ||
# driver_config: | ||
# box: opscode-centos-6.3 | ||
# box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_centos-6.3_provisionerless.box | ||
- name: centos-6.4 | ||
driver_config: | ||
box: opscode-centos-6.4 | ||
box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_centos-6.4_provisionerless.box | ||
|
||
suites: | ||
- name: default | ||
run_list: | ||
- recipe[newrelic::default] | ||
attributes: | ||
newrelic: | ||
license: 78defba8b120b1f16f269f6f53bac7234fe83ee9 | ||
# server-monitor-agent: | ||
# service_notify_action: nothing | ||
# service_actions: | ||
# - nothing | ||
# - name: dotnet-agent | ||
# run_list: | ||
# - recipe[newrelic::dotnet-agent] | ||
# - name: java-agent | ||
# run_list: | ||
# - recipe[newrelic::java-agent] | ||
# - name: meetme-plugin | ||
# run_list: | ||
# - recipe[newrelic::meetme-plugin] | ||
# - name: nodejs-agent | ||
# run_list: | ||
# - recipe[newrelic::nodejs-agent] | ||
# - name: php-agent | ||
# run_list: | ||
# - recipe[newrelic::php-agent] | ||
# - name: python-agent | ||
# run_list: | ||
# - recipe[newrelic::python-agent] | ||
- name: repository | ||
run_list: | ||
- recipe[newrelic::repository] | ||
# - name: ruby-agent | ||
# run_list: | ||
# - recipe[newrelic::ruby-agent] | ||
- name: server-monitor-agent | ||
run_list: | ||
- recipe[newrelic::server-monitor-agent] | ||
attributes: | ||
newrelic: | ||
server-monitor-agent: | ||
service_notify_action: nothing | ||
service_actions: | ||
- nothing |
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,23 @@ | ||
AlignParameters: | ||
Enabled: false | ||
|
||
FileName: | ||
Enabled: false | ||
|
||
Encoding: | ||
Enabled: false | ||
|
||
LineLength: | ||
Max: 200 | ||
|
||
HashSyntax: | ||
EnforcedStyle: hash_rockets | ||
|
||
RedundantBegin: | ||
Enabled: false | ||
|
||
UselessAssignment: | ||
Enabled: false | ||
|
||
MethodLength: | ||
Enabled: false |
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,15 @@ | ||
Contributing | ||
========= | ||
|
||
1. Fork it | ||
2. Create your feature branch (`git checkout -b my-new-feature`) | ||
3. Commit your changes (`git commit -am 'Add some feature'`) | ||
4. [Add tests for your changes](https://github.com/escapestudios-cookbooks/newrelic/blob/master/TESTING.md) | ||
4. Push your changes to your feature branch (`git push origin my-new-feature`) | ||
5. Create a new Pull Request (PR) | ||
|
||
## Testing | ||
Contributions will only be accepted if they are fully tested as specified in [TESTING.md](https://github.com/escapestudios-cookbooks/newrelic/blob/master/TESTING.md). | ||
|
||
## metadata.rb | ||
Please do not modify the version number in the metadata.rb; not all changes to the cookbook may be merged and released in the same version. We will handle the version updates during the release process. |
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,6 +1,17 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'foodcritic' | ||
gem 'berkshelf' | ||
gem 'test-kitchen' | ||
gem 'kitchen-vagrant' | ||
|
||
group :testing do | ||
gem 'rake' | ||
gem 'rubocop' | ||
gem 'foodcritic' | ||
gem 'chefspec' | ||
gem 'thor' | ||
end | ||
|
||
group :integration do | ||
gem 'test-kitchen' | ||
gem 'kitchen-vagrant' | ||
gem 'serverspec' | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
require 'rspec/core/rake_task' | ||
require 'rubocop/rake_task' | ||
require 'foodcritic' | ||
require 'kitchen' | ||
|
||
#syntax/lint checks | ||
namespace :lint do | ||
desc 'Run Ruby syntax/lint checks' | ||
Rubocop::RakeTask.new(:ruby) | ||
|
||
desc 'Run Chef syntax/lint checks' | ||
FoodCritic::Rake::LintTask.new(:chef) { |task| | ||
task.options = { fail_tags: ['any'] } | ||
} | ||
end | ||
|
||
desc 'Run all syntax/lint checks' | ||
task lint: ['lint:ruby', 'lint:chef'] | ||
|
||
#unit testing: ChefSpec | ||
desc 'Run RSpec and ChefSpec unit tests' | ||
RSpec::Core::RakeTask.new(:unit) | ||
|
||
#integration testing: Test Kitchen | ||
namespace :integration do | ||
desc 'Run Test Kitchen integration tests with Vagrant' | ||
task :vagrant do | ||
Kitchen.logger = Kitchen.default_file_logger | ||
Kitchen::Config.new.instances.each do |instance| | ||
instance.test(:always) | ||
end | ||
end | ||
|
||
# desc 'Run Test Kitchen integration tests with cloud plugins' | ||
# task :cloud do | ||
# run_kitchen = true | ||
# if ENV['TRAVIS'] == 'true' && ENV['TRAVIS_PULL_REQUEST'] != 'false' | ||
# run_kitchen = false | ||
# end | ||
# | ||
# if run_kitchen | ||
# Kitchen.logger = Kitchen.default_file_logger | ||
# @loader = Kitchen::Loader::YAML.new(project_config: './.kitchen.cloud.yml') | ||
# config = Kitchen::Config.new( loader: @loader) | ||
# config.instances.each do |instance| | ||
# instance.test(:always) | ||
# end | ||
# end | ||
# end | ||
end | ||
|
||
desc 'Run all integration tests' | ||
#task integration: ['integration:vagrant', 'integration:cloud'] | ||
task integration: ['integration:vagrant'] | ||
|
||
#Travic CI | ||
desc 'Run tests on Travis CI' | ||
task travis: ['lint', 'unit'] | ||
|
||
#the default rake task should just run it all | ||
task default: ['lint', 'unit', 'integration'] |
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,47 @@ | ||
Testing the cookbook | ||
==================== | ||
|
||
Contributions to this cookbook will only be accepted if all tests pass successfully: | ||
|
||
* Ruby syntax/lint checks: [RuboCop](http://batsov.com/rubocop/) | ||
* Chef syntax/lint checks: [Foodcritic](http://acrmp.github.io/foodcritic/) | ||
* Unit tests: [ChefSpec](http://code.sethvargo.com/chefspec/) | ||
* Integration tests: [Test Kitchen](http://kitchen.ci/) | ||
|
||
Setting up the test environment | ||
------------------------------- | ||
|
||
Install the latest version of [Vagrant](http://www.vagrantup.com/downloads.html) and [VirtualBox](https://www.virtualbox.org/wiki/Downloads) (free) or [VMWare Fusion](http://www.vmware.com/products/fusion) (paid). | ||
|
||
Clone the latest version of the cookbook from the repository. | ||
|
||
git clone [email protected]:escapestudios-cookbooks/newrelic.git | ||
cd newrelic | ||
|
||
Install the gems used for testing: | ||
|
||
bundle install | ||
|
||
Install the berkshelf plugin for vagrant: | ||
|
||
vagrant plugin install vagrant-berkshelf | ||
|
||
Running syntax/lint checks | ||
-------------------------- | ||
|
||
bundle exec rake lint | ||
|
||
Running unit tests | ||
------------------ | ||
|
||
bundle exec rake unit | ||
|
||
Running integration tests | ||
------------------------- | ||
|
||
bundle exec rake integration | ||
|
||
Running all checks/tests | ||
------------------------ | ||
|
||
bundle exec rake |
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,29 @@ | ||
name "newrelic" | ||
maintainer "Escape Studios" | ||
maintainer_email "[email protected]" | ||
license "MIT" | ||
description "Installs/Configures New Relic" | ||
name 'newrelic' | ||
maintainer 'Escape Studios' | ||
maintainer_email '[email protected]' | ||
license 'MIT' | ||
description 'Installs/Configures New Relic' | ||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) | ||
version "1.0.1" | ||
version '1.0.1' | ||
|
||
%w{ debian ubuntu redhat centos fedora scientific amazon windows smartos }.each do |os| | ||
supports os | ||
%w({ debian ubuntu redhat centos fedora scientific amazon windows smartos }).each do |os| | ||
supports os | ||
end | ||
|
||
depends "python" | ||
depends 'python' | ||
|
||
recommends "php" | ||
recommends "ms_dotnet4" | ||
recommends "curl" | ||
recommends "nodejs" | ||
recommends 'php' | ||
recommends 'ms_dotnet4' | ||
recommends 'curl' | ||
recommends 'nodejs' | ||
|
||
recipe "newrelic", "Adds the New Relic repository, installs & configures the New Relic server monitor agent." | ||
recipe "newrelic::repository", "Adds the New Relic repository." | ||
recipe "newrelic::server-monitor-agent", "Installs & configures the New Relic server monitor agent." | ||
recipe "newrelic::dotnet-agent", "Installs New Relic .NET agent" | ||
recipe "newrelic::java-agent", "Installs the New Relic Java agent." | ||
recipe "newrelic::nodejs-agent", "Installs New Relic Node.js agent" | ||
recipe "newrelic::php-agent", "Installs the New Relic PHP agent." | ||
recipe "newrelic::python-agent", "Installs the New Relic Python agent." | ||
recipe "newrelic::ruby-agent", "Installs the New Relic Ruby agent." | ||
recipe "newrelic::meetme-plugin", "Installs the New Relic MeetMe plugin." | ||
recipe 'newrelic', 'Adds the New Relic repository, installs & configures the New Relic server monitor agent.' | ||
recipe 'newrelic::repository', 'Adds the New Relic repository.' | ||
recipe 'newrelic::server-monitor-agent', 'Installs & configures the New Relic server monitor agent.' | ||
recipe 'newrelic::dotnet-agent', 'Installs New Relic .NET agent.' | ||
recipe 'newrelic::java-agent', 'Installs the New Relic Java agent.' | ||
recipe 'newrelic::nodejs-agent', 'Installs New Relic Node.js agent.' | ||
recipe 'newrelic::php-agent', 'Installs the New Relic PHP agent.' | ||
recipe 'newrelic::python-agent', 'Installs the New Relic Python agent.' | ||
recipe 'newrelic::ruby-agent', 'Installs the New Relic Ruby agent.' | ||
recipe 'newrelic::meetme-plugin', 'Installs the New Relic MeetMe plugin.' |