Created
June 28, 2013 03:10
-
-
Save maxlinc/5882219 to your computer and use it in GitHub Desktop.
Fast acceptance test runner
This file contains hidden or 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
namespace :module do | |
desc 'Run acceptance tests for each module' | |
task :acceptance do | |
run "vagrant up --no-provision" | |
run "vagrant sandbox on" | |
Dir['my_modules/*/tests/*.pp'].each do |test_file| | |
puts "Running test #{test_file}" | |
run "MANIFEST_FILE=/etc/puppet/#{test_file} vagrant provision" | |
run "vagrant sandbox rollback" | |
end | |
end | |
end | |
def run(cmd) | |
Bundler.with_clean_env do | |
sh "cd my_modules && #{cmd}" | |
end | |
end |
This file contains hidden or 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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure("2") do |config| | |
config.vm.synced_folder "..", "/etc/puppet" | |
config.vm.provision :shell, :inline => "puppet apply --modulepath '/etc/puppet/modules:/etc/puppet/my_modules/' #{ENV['MANIFEST_FILE']} --detailed-exitcodes || [ $? -eq 2 ]" | |
config.vm.box = "ubuntu_precise64" | |
config.vm.hostname = "module-test.example.com" | |
config.vm.box_url = "http://f.willianfernandes.com.br/vagrant-boxes/UbuntuServer12.04amd64.box" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment