Skip to content

Commit

Permalink
Add a test:integration task and use the latest built tarball for the …
Browse files Browse the repository at this point in the history
…tests
  • Loading branch information
R. Tyler Croy committed Apr 4, 2012
1 parent 92edb28 commit 39f8998
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 25 deletions.
58 changes: 35 additions & 23 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,35 +1,14 @@
require 'rake'
require 'rspec/core/rake_task'
require 'cucumber/rake/task'

task :default => [:spec]

desc "Make sure some of the rspec-puppet directories/files are in place"
task :test_check do
dot_puppet = File.expand_path('~/.puppet')
unless File.exists?(dot_puppet) and File.directory?(dot_puppet)
puts 'rspec-puppet needs a ~/.puppet directory to run properly'
puts
puts 'I\'ll go ahead and make one for you'
Dir.mkdir(dot_puppet)
puts
end

unless File.exists?(File.join(dot_puppet, '/manifests/site.pp'))
puts 'rspec puppet needs (dummy) ~/.puppet/manifests/site.pp file to run properly'
puts
puts 'I\'ll go ahead and make one for you'
Dir.mkdir(File.join(dot_puppet, '/manifests'))
File.open(File.join(dot_puppet, '/manifests/site.pp'), 'w') do |fd|
fd.write('')
end
end
end


# This task is here because I can't figure out how to properly make a dependent
# task for :spec_task
desc "Run all module spec tests (Requires rspec-puppet gem)"
task :spec => [:test_check, :spec_task] do
task :spec => [:"test:check", :spec_task] do
end

RSpec::Core::RakeTask.new(:spec_task) do |t|
Expand All @@ -41,3 +20,36 @@ task :build do
sh 'puppet-module build'
end


namespace :test do
desc "Run the full integration test suite (slow!)"
task :integration => [:spec, :build, :cucumber] do
end

desc "Make sure some of the rspec-puppet directories/files are in place"
task :check do
dot_puppet = File.expand_path('~/.puppet')
unless File.exists?(dot_puppet) and File.directory?(dot_puppet)
puts 'rspec-puppet needs a ~/.puppet directory to run properly'
puts
puts 'I\'ll go ahead and make one for you'
Dir.mkdir(dot_puppet)
puts
end

unless File.exists?(File.join(dot_puppet, '/manifests/site.pp'))
puts 'rspec puppet needs (dummy) ~/.puppet/manifests/site.pp file to run properly'
puts
puts 'I\'ll go ahead and make one for you'
Dir.mkdir(File.join(dot_puppet, '/manifests'))
File.open(File.join(dot_puppet, '/manifests/site.pp'), 'w') do |fd|
fd.write('')
end
end
end

Cucumber::Rake::Task.new do |t|
t.cucumber_opts = ['--color', '--format pretty',
'--format junit -o test_reports']
end
end
4 changes: 2 additions & 2 deletions features/step_definitions/deb_support_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
end

Given /^the Jenkins module is on the machine$/ do
tarball = Dir['pkg/rtyler-jenkins*.tar.gz'].last
package_path = File.join(@project_root, tarball)
tarball = Dir['pkg/rtyler-jenkins*.tar.gz'].last.gsub('pkg/', '')
package_path = File.join(@project_root, 'pkg', tarball)
FileUtils.cp(package_path, @vagrant_root)

puts 'Installing module pre-requisites'
Expand Down

0 comments on commit 39f8998

Please sign in to comment.