This repository has been archived by the owner on Dec 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 353
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
100 additions
and
99 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
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,13 @@ | ||
metadata | ||
# Encoding: utf-8 | ||
|
||
# Don't need to list cookbooks in here that are also listed in the metadata depends statements | ||
# unless there are specific overrides like git repo or version are needed | ||
metadata | ||
|
||
cookbook 'rabbitmq', git: 'git://github.com/opscode-cookbooks/rabbitmq.git' | ||
|
||
group :test do | ||
cookbook 'minitest-handler', git: 'git://github.com/btm/minitest-handler-cookbook.git' | ||
cookbook 'elasticsearch', git: 'git://github.com/elasticsearch/cookbook-elasticsearch.git' | ||
cookbook 'kibana', git: 'git://github.com/lusis/chef-kibana.git' | ||
cookbook 'curl' | ||
cookbook 'ark' | ||
cookbook 'minitest-handler', git: 'git://github.com/btm/minitest-handler-cookbook.git' | ||
cookbook 'elasticsearch', git: 'git://github.com/elasticsearch/cookbook-elasticsearch.git' | ||
cookbook 'kibana', git: 'git://github.com/lusis/chef-kibana.git' | ||
cookbook 'curl' | ||
cookbook 'ark' | ||
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
source "https://rubygems.org" | ||
# Encoding: utf-8 | ||
|
||
source 'https://rubygems.org' | ||
|
||
gem 'berkshelf' |
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,56 +1,73 @@ | ||
#!/usr/bin/env rake | ||
# Encoding: utf-8 | ||
|
||
@cookbook_path = '/tmp/logstash-cookbooks' | ||
@cookbook = "logstash" | ||
@cookbook = 'logstash' | ||
@gemfile = "#{File.dirname(__FILE__)}/test/support/Gemfile" | ||
|
||
desc "install dependencies using Berkshelf" | ||
desc 'install dependencies using Berkshelf' | ||
task :install_deps do | ||
system("berks install --path=#{@cookbook_path}") | ||
install_deps | ||
end | ||
|
||
desc "Runs foodcritic linter" | ||
desc 'Runs foodcritic linter' | ||
task :foodcritic do | ||
if Gem::Version.new("1.9.2") <= Gem::Version.new(RUBY_VERSION.dup) | ||
if Gem::Version.new('1.9.2') <= Gem::Version.new(RUBY_VERSION.dup) | ||
sandbox = File.join(File.dirname(__FILE__), %w{tmp foodcritic}, @cookbook) | ||
prepare_test_sandbox(sandbox) | ||
|
||
sh "foodcritic --epic-fail any #{File.dirname(sandbox)}" | ||
else | ||
puts "WARN: foodcritic run is skipped as Ruby #{RUBY_VERSION} is < 1.9.2." | ||
end | ||
end | ||
|
||
desc "Runs Strainer" | ||
desc 'Runs Strainer' | ||
task :strainer do | ||
if Gem::Version.new("1.9.2") <= Gem::Version.new(RUBY_VERSION.dup) | ||
sandbox = '/tmp/cookbook_logstash' | ||
prepare_test_sandbox(sandbox) | ||
rm_rf '/tmp/strainer' | ||
gemfile="#{File.dirname(__FILE__)}/test/support/Gemfile" | ||
puts gemfile | ||
sh "cd #{sandbox} && BUNDLE_GEMFILE=#{gemfile} bundle exec strainer test --sandbox=/tmp/strainer --cookbooks-path=#{@cookbook_path}" | ||
if Gem::Version.new('1.9.2') <= Gem::Version.new(RUBY_VERSION.dup) | ||
# sandbox = '/tmp/cookbook_logstash' | ||
# prepare_test_sandbox(sandbox) | ||
# rm_rf '/tmp/strainer' | ||
install_deps | ||
# puts gemfile | ||
puts "BUNDLE_GEMFILE=#{@gemfile} bundle exec strainer test --sandbox=/tmp/strainer --cookbooks-path=#{@cookbook_path}" | ||
system({ 'BUNDLE_GEMFILE' => @gemfile }, "bundle exec strainer test --sandbox=/tmp/strainer --cookbooks-path=#{@cookbook_path}") | ||
else | ||
puts "WARN: strainer run is skipped as Ruby #{RUBY_VERSION} is < 1.9.2." | ||
end | ||
end | ||
|
||
task :default => 'foodcritic' | ||
desc 'Runs Test Kitchen' | ||
task :kitchen do | ||
begin | ||
require 'kitchen/rake_tasks' | ||
Kitchen::RakeTasks.new | ||
rescue LoadError | ||
puts '>>>>> Kitchen gem not loaded, omitting tasks' unless ENV['CI'] | ||
end | ||
if Gem::Version.new('1.9.2') <= Gem::Version.new(RUBY_VERSION.dup) | ||
install_deps | ||
system({ 'BUNDLE_GEMFILE' => @gemfile }, 'bundle exec kitchen test --destroy=always') | ||
end | ||
end | ||
|
||
task default: 'strainer' | ||
|
||
private | ||
|
||
def install_deps | ||
puts "BUNDLE_GEMFILE=#{@gemfile} bundle exec berks install --path=#{@cookbook_path}" | ||
system({ 'BUNDLE_GEMFILE' => @gemfile }, "bundle exec berks install --path=#{@cookbook_path}") | ||
end | ||
|
||
private | ||
|
||
def prepare_test_sandbox(sandbox) | ||
files = %w{ *.md *.rb attributes definitions files providers Strainerfile .rubocop* | ||
recipes resources templates spec } | ||
recipes resources templates test/integration test/serverspec } | ||
|
||
rm_rf sandbox | ||
mkdir_p sandbox | ||
cp_r Dir.glob("{#{files.join(',')}}"), sandbox | ||
puts "\n\n" | ||
end | ||
|
||
begin | ||
require 'kitchen/rake_tasks' | ||
Kitchen::RakeTasks.new | ||
rescue LoadError | ||
puts ">>>>> Kitchen gem not loaded, omitting tasks" unless ENV['CI'] | ||
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
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,10 +1,11 @@ | ||
# Encoding: utf-8 | ||
require 'spec_helper' | ||
|
||
describe 'logstash server' do | ||
it { pending 'it writes the tests for its code or else it gets the hose again' } | ||
it { pending 'it writes the tests for the code or else it gets the hose again' } | ||
end | ||
|
||
describe service('logstash_server') do | ||
it { should be_enabled } | ||
it { should be_running } | ||
it { should be_enabled } | ||
it { should be_running } | ||
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,11 +1,13 @@ | ||
source "https://rubygems.org" | ||
# Encoding: utf-8 | ||
|
||
source 'https://rubygems.org' | ||
|
||
gem 'rake', '~> 10.1.0' | ||
gem 'foodcritic', '~> 3.0.0', :platforms => :ruby_19 | ||
gem 'chef', '~> 11.8.0', :platforms => :ruby_19 | ||
gem 'berkshelf', '~> 2.0.0', :platforms => :ruby_19 | ||
gem 'rubocop', '~> 0.16.0', :platforms => :ruby_19 | ||
gem 'chefspec', '~> 3.1.4', :platforms => :ruby_19 | ||
gem 'strainer', '~> 3.3.0', :platforms => :ruby_19 | ||
gem 'test-kitchen', '~> 1.1.1', :platforms => :ruby_19 | ||
gem 'foodcritic', '~> 3.0.0', platforms: :ruby_19 | ||
gem 'chef', '~> 11.8.0', platforms: :ruby_19 | ||
gem 'berkshelf', '~> 2.0.0', platforms: :ruby_19 | ||
gem 'rubocop', '~> 0.16.0', platforms: :ruby_19 | ||
gem 'chefspec', '~> 3.1.4', platforms: :ruby_19 | ||
gem 'strainer', '~> 3.3.0', platforms: :ruby_19 | ||
gem 'test-kitchen', '~> 1.1.1', platforms: :ruby_19 | ||
gem 'kitchen-vagrant' |
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
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
File renamed without changes.
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
Oops, something went wrong.