我已经构建了一些 serverspec 代码来在多个主机上运行一组测试。麻烦的是,当任何测试失败时,测试都会在当前主机上停止。即使测试失败,我也希望它继续到所有主机。
耙文件:
namespace :spec do
task :all => hosts.map {|h| 'spec:' + h.split('.')[0] }
hosts.each do |host|
begin
desc "Run serverspec to #{host}"
RSpec::Core::RakeTask.new(host) do |t|
ENV['TARGET_HOST'] = host
t.pattern = "spec/cfengine3/*_spec.rb"
end
rescue
end
end
end
完整代码: https ://gist.github.com/neilhwatson/1d41c696102c01bbb87a