This repository has been archived by the owner on Jun 4, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(maint) Add rake tasks for running acceptance tests
This adds `rake acceptance:full` and `rake acceptance:smoke` tasks for running acceptance tests.
- Loading branch information
1 parent
89b88cc
commit 5cfa4e2
Showing
3 changed files
with
64 additions
and
1 deletion.
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
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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
require 'rake' | ||
|
||
def generate_hosts(pe_version, hypervisor = 'vmpooler', | ||
test_target = 'centos7-64mdc-64a') | ||
hosts_file = 'hosts.cfg' | ||
puts "Generating hosts..." | ||
cmd = <<HEREDOC | ||
export BUNDLE_PATH=.bundle/gems | ||
export BUNDLE_BIN=.bundle/bin | ||
bundle install | ||
beaker-hostgenerator --pe_dir=http://enterprise.delivery.puppetlabs.net/#{pe_version}/ci-ready \ | ||
--disable-default-role --hypervisor #{hypervisor} #{test_target} > #{hosts_file} | ||
HEREDOC | ||
|
||
Dir.chdir('acceptance'){ | ||
system(cmd) | ||
} | ||
|
||
hosts_file | ||
end | ||
|
||
def run_beaker(hosts_file, tests, package_version) | ||
cmd = <<HEREDOC | ||
# We should change this to SHA and SUITE_VERSION in the acceptance tests | ||
export PE_RAZOR_SERVER_PACKAGE_BUILD_VERSION=#{package_version} | ||
bundle exec beaker --xml --debug --root-keys --repo-proxy --hosts #{hosts_file} \ | ||
--type pe --keyfile ~/.ssh/id_rsa-acceptance --preserve-hosts onfail \ | ||
--helper lib/helper.rb --pre-suite suites/pre_suite/install-server-from-module \ | ||
--tests #{tests} --load-path lib | ||
HEREDOC | ||
|
||
Dir.chdir('acceptance'){ | ||
system(cmd) | ||
} | ||
end | ||
|
||
namespace :acceptance do | ||
desc "Run acceptance tests" | ||
task :full, [:pe_version, :razor_server_version, :hosts_file] do |t, args| | ||
abort("Required argument: :pe_version") if args[:pe_version].nil? | ||
server_version = args[:razor_server_version] || `git rev-parse HEAD` | ||
tests = 'suites/tests/smoke,suites/tests/full' | ||
hosts = args[:hosts_file] | ||
hosts = generate_hosts(args[:pe_version]) if hosts.nil? | ||
run_beaker(hosts, tests, server_version) | ||
end | ||
|
||
desc "Run smoke tests" | ||
task :smoke, [:pe_version, :razor_server_version, :hosts_file] do |t, args| | ||
abort("Required argument: :pe_version") if args[:pe_version].nil? | ||
server_version = args[:razor_server_version] || `git rev-parse HEAD` | ||
tests = 'suites/tests/smoke' | ||
hosts = args[:hosts_file] | ||
hosts = generate_hosts(pe_version) if hosts.nil? | ||
run_beaker(hosts, tests, server_version) | ||
end | ||
end |