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 #764 from rodjek/acceptance_tests
Add some basic acceptance tests
- Loading branch information
Showing
5 changed files
with
77 additions
and
2 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 |
---|---|---|
|
@@ -9,3 +9,4 @@ coverage/ | |
/_site/ | ||
.idea | ||
/*.pp | ||
/tmp/ |
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 |
---|---|---|
|
@@ -26,4 +26,4 @@ before_test: | |
- bundle -v | ||
|
||
test_script: | ||
- bundle exec rake test | ||
- bundle exec rake ci |
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,71 @@ | ||
require 'rake' | ||
require 'open3' | ||
|
||
def run_cmd(message, *cmd) | ||
print(" #{message}...") | ||
|
||
output, status = Open3.capture2e(*cmd) | ||
if status.success? | ||
puts 'Done' | ||
else | ||
puts 'FAILED' | ||
end | ||
|
||
[output.strip, status.success?] | ||
end | ||
|
||
task :release_test do | ||
branch = if ENV['APPVEYOR'] | ||
ENV['APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH'] | ||
elsif ENV['TRAVIS'] | ||
ENV['TRAVIS_PULL_REQUEST_BRANCH'] | ||
else | ||
false | ||
end | ||
|
||
if branch && branch !~ %r{\A\d+_\d+_\d+_release\Z} | ||
puts 'Skipping release tests on feature branch' | ||
exit | ||
end | ||
|
||
modules_to_test = [ | ||
'puppetlabs/puppetlabs-apt', | ||
'puppetlabs/puppetlabs-tomcat', | ||
'puppetlabs/puppetlabs-apache', | ||
'puppetlabs/puppetlabs-mysql', | ||
'puppetlabs/puppetlabs-ntp', | ||
'puppetlabs/puppetlabs-chocolatey', | ||
'voxpupuli/puppet-archive', | ||
'voxpupuli/puppet-collectd', | ||
'garethr/garethr-docker', | ||
'sensu/sensu-puppet', | ||
'jenkinsci/puppet-jenkins', | ||
] | ||
|
||
FileUtils.mkdir_p('tmp') | ||
Dir.chdir('tmp') do | ||
modules_to_test.each do |module_name| | ||
puts "Testing #{module_name}..." | ||
module_dir = File.basename(module_name) | ||
|
||
if File.directory?(module_dir) | ||
Dir.chdir(module_dir) do | ||
_, success = run_cmd('Updating repository', 'git', 'pull', '--rebase') | ||
next unless success | ||
end | ||
else | ||
_, success = run_cmd('Cloning repository', 'git', 'clone', "https://github.com/#{module_name}") | ||
next unless success | ||
end | ||
|
||
Dir.chdir(module_dir) do | ||
output, success = run_cmd('Running puppet-lint', 'bundle', 'exec', 'puppet-lint', '--relative', '--no-documentation-check', 'manifests') | ||
unless output.empty? | ||
output.split("\n").each do |line| | ||
puts " #{line}" | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |