summaryrefslogtreecommitdiff
path: root/Rakefile
diff options
context:
space:
mode:
authorJohn Duarte <john.duarte@puppetlabs.com>2014-05-21 18:25:54 -0700
committerJohn Duarte <john.duarte@puppetlabs.com>2014-05-21 18:25:54 -0700
commitc2108b67f6349068ae897265b28a7242d230be1b (patch)
tree1a6f544461b9747e290ee01b6df9960501ce1975 /Rakefile
parent2f875839afe843bd8a9f320d553fb3a28a7420f8 (diff)
Adjust Rake tasks for beaker testing
Adjust Rake tasks for testing beaker-rspec suite, beaker suite, and both in combination. The beaker hosts config file is set via the BEAKER_setfile environmental variable. The hosts defined within this file supersede the host past in as an argument, but the argument is still required. For an arbitrary hosts config file this provides the following options. 1. Run the beaker-rspec test suite BEAKER_setfile=/path/to/my_hosts.cfg rake beaker:rspec:test[foo,pe] 2. Run the beaker test suite BEAKER_setfile=/path/to/my_hosts.cfg rake beaker:test[foo,pe] 3. Run both beaker-rspec and beaker test suites BEAKER_setfile=/path/to/my_hosts.cfg rake beaker:test:all[foo,pe]
Diffstat (limited to 'Rakefile')
-rwxr-xr-xRakefile32
1 files changed, 19 insertions, 13 deletions
diff --git a/Rakefile b/Rakefile
index 3ccf664..36a7998 100755
--- a/Rakefile
+++ b/Rakefile
@@ -1,18 +1,18 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'rake'
-task 'beaker:test',[:host,:type] => :set_beaker_variables do |t,args|
+desc "Run beaker-rspec and beaker tests"
+task 'beaker:test:all',[:host,:type] => ["rake:beaker:rspec:test", "rake:beaker:test"] do |t,args|
+end
+desc "Run beaker-rspec tests"
+task 'beaker:rspec:test',[:host,:type] => [:set_beaker_variables] do |t,args|
Rake::Task['beaker-rspec:test'].invoke(args)
+end
- if File.exists?('./acceptance')
- Dir.chdir('./acceptance')
- exec(build_beaker_command args)
- Dir.chdir('../')
- else
- puts "No acceptance directory found, not running beaker tests"
- end
-
+desc "Run beaker tests"
+task 'beaker:test',[:host,:type] => [:set_beaker_variables] do |t,args|
+ sh(build_beaker_command args)
end
desc "Run beaker rspec tasks against pe"
@@ -40,6 +40,9 @@ task :set_beaker_variables do |t,args|
puts "Host to test #{ENV['BEAKER_set']}"
end
ENV['BEAKER_IS_PE'] = args[:type] == 'pe'? "true": "false"
+ if ENV['BEAKER_setfile']
+ @hosts_config = ENV['BEAKER_setfile']
+ end
end
def build_beaker_command(args)
@@ -48,11 +51,14 @@ def build_beaker_command(args)
if File.exists?("./.beaker-#{args[:type]}.cfg")
cmd << "--options-file ./.beaker-#{args[:type]}.cfg"
end
- if File.exists?("config/#{args[:host]}.cfg")
- cmd << "--hosts config/#{args[:host]}.cfg"
+ if File.exists?(@hosts_config)
+ cmd << "--hosts #{@hosts_config}"
+ end
+ if File.exists?('./spec/acceptance/beaker_helper.rb')
+ cmd << "--pre-suite ./spec/acceptance/beaker_helper.rb"
end
- if File.exists?("./tests")
- cmd << "--tests ./tests"
+ if File.exists?("./spec/acceptance/beaker")
+ cmd << "--tests ./spec/acceptance/beaker"
end
cmd.join(" ")
end