forked from petems/puppet-install-shell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
36 lines (32 loc) · 931 Bytes
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
require 'simp/rake/pupmod/helpers'
Simp::Rake::Pupmod::Helpers.new(File.dirname(__FILE__))
def stdout_redirect(command)
f = IO.popen(command)
while line = f.gets
puts line
end
f.close
$?.to_i
end
def only_zero?(array)
array.count(0) == array.size
end
namespace :acceptance do
desc "Run all suites for nodeset"
task :suite_on_nodeset, [:nodeset] do |_t, args|
exit_code_array = []
suitenames = Dir.glob('./spec/acceptance/suites/*').select {|f| File.directory? f}
puts "Suites found: #{suitenames}"
suitenames.each do | suite |
suite_command = "bundle exec rake beaker:suites[#{File.basename(suite)},#{args[:nodeset]}]"
puts "Running #{suite_command}"
exit_code = stdout_redirect(suite_command)
puts "Exit code #{exit_code}"
exit_code_array << exit_code
end
unless only_zero?(exit_code_array)
puts "Error detected!"
exit 1
end
end
end