forked from puppetlabs/puppetlabs-acl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
43 lines (37 loc) · 1.09 KB
/
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
37
38
39
40
41
42
43
require 'rake'
require 'rspec/core/rake_task'
require 'puppetlabs_spec_helper/rake_tasks'
begin
require 'beaker/tasks/test' unless RUBY_PLATFORM =~ /win32/
rescue LoadError
#Do nothing, only installed with system_tests group
end
task :default => [:test]
desc 'Run RSpec'
RSpec::Core::RakeTask.new(:test) do |t|
t.pattern = 'spec/{unit}/**/*.rb'
# t.rspec_opts = ['--color']
end
desc 'Generate code coverage'
RSpec::Core::RakeTask.new(:coverage) do |t|
t.rcov = true
t.rcov_opts = ['--exclude', 'spec']
end
desc 'Run Beaker PE Tests'
task :beaker_pe, [:hosts, :tests] do |t, args|
args.with_defaults({:type => 'pe'})
system(build_command(args))
end
desc 'Run Beaker Git Tests'
task :beaker_git, [:hosts, :tests] do |t, args|
args.with_defaults({:type => 'git'})
system(build_command(args))
end
def build_command(args)
cmd_parts = []
cmd_parts << "beaker"
cmd_parts << "--options-file ./acceptance/.beaker-#{args[:type]}.cfg"
cmd_parts << "--hosts #{args[:hosts]}" if !args.hosts.empty?
cmd_parts << "--tests #{args.tests}" if !args.tests.empty?
cmd_parts.flatten.join(" ")
end