-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #142 from strider/RSPECTestsInfra
Add Rakefile to run rspec tests over all the puppet modules.
- Loading branch information
Showing
4 changed files
with
77 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
*.swp | ||
Gemfile.lock | ||
.vendor | ||
vendor | ||
*/spec/* |
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,19 @@ | ||
language: ruby | ||
install: | ||
- gem install bundler | ||
- gem install rake | ||
- gem install r10k | ||
script: "rake test SPEC_OPTS='--format documentation --color --backtrace'" | ||
rvm: | ||
- 1.9.3 | ||
- 2.0.0 | ||
matrix: | ||
fast_finish: true | ||
env: | ||
matrix: | ||
- PUPPET_GEM_VERSION="~> 3.3.0" | ||
- PUPPET_GEM_VERSION="~> 3.4.0" | ||
- PUPPET_GEM_VERSION="~> 3.6.0" | ||
- PUPPET_GEM_VERSION="~> 3.7.0" | ||
notifications: | ||
email: 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
source ENV['GEM_SOURCE'] || "https://rubygems.org" | ||
|
||
group :development, :test do | ||
gem 'bundler' | ||
gem 'r10k' | ||
gem 'rake', '10.1.1' | ||
end | ||
|
||
if facterversion = ENV['FACTER_GEM_VERSION'] | ||
gem 'facter', facterversion, :require => false | ||
else | ||
gem 'facter', :require => false | ||
end | ||
|
||
if puppetversion = ENV['PUPPET_GEM_VERSION'] | ||
gem 'puppet', puppetversion, :require => false | ||
else | ||
gem 'puppet', :require => false | ||
end | ||
|
||
# vim:ft=ruby |
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,32 @@ | ||
task(:default).clear | ||
task :default => :test | ||
|
||
desc 'Run Puppetfile Validation' | ||
task :test => [:validate_puppetfile,:all_modules] | ||
|
||
desc "Validate the Puppetfile syntax" | ||
task :validate_puppetfile do | ||
$stderr.puts "---> syntax:puppetfile" | ||
sh "r10k puppetfile check" | ||
end | ||
|
||
desc "Run rspec tests for each modules" | ||
task :all_modules do | ||
FileList["*/Rakefile"].each do |project| | ||
dir = project.pathmap("%d") | ||
Dir.chdir(dir) do | ||
puts "======" | ||
puts "= Running spec test for #{project}" | ||
puts "======" | ||
system('rm -Rf vendor/') | ||
system('rm -Rf .bundle/') | ||
FileUtils.mkdir 'vendor' | ||
ENV['GEM_HOME'] = "vendor" | ||
system('bundle install --path=vendor/ --gemfile=./Gemfile') | ||
ENV['BUNDLE_GEMFILE'] = "./Gemfile" | ||
system('bundle exec rake spec') | ||
system('rm -Rf vendor') | ||
system('rm -Rf .bundle/') | ||
end | ||
end | ||
end |