beaker 2.47.1 → 2.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/CONTRIBUTING.md +5 -5
- data/HISTORY.md +288 -2
- data/README.md +36 -15
- data/Rakefile +4 -4
- data/acceptance/tests/base/dsl/helpers/host_helpers/archive_file_from_test.rb +35 -0
- data/acceptance/tests/base/host_test.rb +16 -16
- data/acceptance/tests/install/from_file.rb +20 -0
- data/acceptance/tests/puppet/stub_host.rb +47 -0
- data/beaker.gemspec +1 -6
- data/docs/README.md +16 -26
- data/docs/{Argument-Processing-and-Precedence.md → concepts/argument_processing_and_precedence.md} +9 -9
- data/docs/{Beaker-Libraries.md → concepts/beaker_libraries.md} +0 -0
- data/docs/{beaker-vs.-beaker-rspec.md → concepts/beaker_vs_beaker_rspec.md} +0 -0
- data/docs/{Beaker-with-Masterless-Puppet.md → concepts/masterless_puppet.md} +0 -0
- data/docs/{Roles-What-Are-They.md → concepts/roles_what_are_they.md} +0 -0
- data/docs/{Shared-Options-for-Executing-Beaker-Commands.md → concepts/shared_options_for_executing_beaker_commands.md} +1 -1
- data/docs/{Beaker-Test-Tagging.md → concepts/test_tagging.md} +0 -0
- data/docs/{meta → concepts}/ticket_process.md +0 -0
- data/docs/{Types,-Puppet-4,-and-the-All-In-One-Agent.md → concepts/types_puppet_4_and_the_all_in_one_agent.md} +0 -0
- data/docs/{Access-the-Live-Test-Console-with-Pry.md → how_to/access_the_live_test_console_with_pry.md} +0 -0
- data/docs/{dsl → how_to}/confine.md +0 -0
- data/docs/{hosts → how_to/hosts}/README.md +0 -0
- data/docs/{hosts → how_to/hosts}/cisco.md +0 -0
- data/docs/{hosts → how_to/hosts}/eos.md +0 -0
- data/docs/{hypervisors → how_to/hypervisors}/README.md +0 -0
- data/docs/{hypervisors → how_to/hypervisors}/aws.md +0 -0
- data/docs/{hypervisors → how_to/hypervisors}/docker.md +0 -0
- data/docs/{hypervisors → how_to/hypervisors}/ec2.md +0 -0
- data/docs/{hypervisors → how_to/hypervisors}/google_compute_engine.md +0 -0
- data/docs/{hypervisors → how_to/hypervisors}/openstack.md +0 -0
- data/docs/{hypervisors → how_to/hypervisors}/solaris.md +0 -0
- data/docs/{hypervisors → how_to/hypervisors}/vagrant.md +0 -0
- data/docs/{hypervisors → how_to/hypervisors}/vagrant_hosts_file_examples.md +0 -0
- data/docs/{hypervisors → how_to/hypervisors}/vmware_fusion.md +0 -0
- data/docs/{hypervisors → how_to/hypervisors}/vsphere.md +0 -0
- data/docs/{dsl → how_to}/platform_specific_tag_confines.md +0 -0
- data/docs/how_to/preserve_hosts.md +80 -0
- data/docs/how_to/rake_tasks.md +49 -0
- data/docs/{Beaker-Recipes.md → how_to/recipes.md} +0 -0
- data/docs/{runner → how_to}/run_in_parallel.md +0 -0
- data/docs/{The-Beaker-DSL.md → how_to/the_beaker_dsl.md} +0 -0
- data/docs/{How-To-Use-User-Password-Authentication-with-Beaker.md → how_to/use_user_password_authentication.md} +0 -0
- data/docs/{How-to-Write-a-Beaker-Test-for-a-Module.md → how_to/write_a_beaker_test_for_a_module.md} +2 -2
- data/docs/{Creating-A-Test-Environment.md → tutorials/creating_a_test_environment.md} +13 -10
- data/docs/tutorials/how_to_beaker.md +6 -0
- data/docs/{Beaker-Installation.md → tutorials/installation.md} +0 -0
- data/docs/{Lets-Write-a-Test.md → tutorials/lets_write_a_test.md} +18 -11
- data/docs/{runner → tutorials}/test_run.md +0 -0
- data/docs/{runner → tutorials}/test_suites.md +0 -0
- data/docs/{The-Command-Line.md → tutorials/the_command_line.md} +0 -0
- data/lib/beaker/dsl/helpers/host_helpers.rb +39 -0
- data/lib/beaker/dsl/helpers/puppet_helpers.rb +22 -17
- data/lib/beaker/dsl/install_utils/foss_utils.rb +19 -11
- data/lib/beaker/dsl/install_utils/windows_utils.rb +39 -0
- data/lib/beaker/host/mac/pkg.rb +20 -2
- data/lib/beaker/host/unix/exec.rb +4 -4
- data/lib/beaker/host/unix/pkg.rb +1 -1
- data/lib/beaker/test_suite.rb +12 -5
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/dsl/helpers/puppet_helpers_spec.rb +33 -9
- data/spec/beaker/dsl/install_utils/foss_utils_spec.rb +24 -0
- data/spec/beaker/host_spec.rb +10 -10
- data/spec/beaker/test_suite_spec.rb +23 -0
- metadata +46 -99
- data/docs/How-To-Beaker.md +0 -6
- data/docs/meta/README.md +0 -6
@@ -0,0 +1,35 @@
|
|
1
|
+
require "helpers/test_helper"
|
2
|
+
|
3
|
+
test_name "dsl::helpers::host_helpers #archive_file_from" do
|
4
|
+
|
5
|
+
step "archiveroot parameter defaults to `archive/sut-files`" do
|
6
|
+
# Create a remote file to archive
|
7
|
+
filepath = default.tmpfile('archive-file-test')
|
8
|
+
create_remote_file(default, filepath, 'contents ignored')
|
9
|
+
|
10
|
+
# Prepare cleanup so we don't pollute the local filesystem
|
11
|
+
teardown do
|
12
|
+
FileUtils.rm_rf('archive') if Dir.exists?('archive')
|
13
|
+
end
|
14
|
+
|
15
|
+
# Test that the archiveroot default directory is created
|
16
|
+
assert_equal(false, Dir.exists?('archive'))
|
17
|
+
assert_equal(false, Dir.exists?('archive/sut-files'))
|
18
|
+
archive_file_from(default, filepath)
|
19
|
+
assert_equal(true, Dir.exists?('archive/sut-files'))
|
20
|
+
end
|
21
|
+
|
22
|
+
step "file is copied to local <archiveroot>/<host name> directory" do
|
23
|
+
# Create a remote file to archive
|
24
|
+
filepath = default.tmpfile('archive-file-test')
|
25
|
+
create_remote_file(default, filepath, 'number of the beast')
|
26
|
+
|
27
|
+
# Test that the file is copied locally to <archiveroot>/<hostname>/<filepath>
|
28
|
+
Dir.mktmpdir do |tmpdir|
|
29
|
+
archive_file_from(default, filepath, {}, tmpdir)
|
30
|
+
expected_path = File.join(tmpdir, default, filepath)
|
31
|
+
assert(File.exists?(expected_path))
|
32
|
+
assert_equal('number of the beast', File.read(expected_path).strip)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -33,33 +33,33 @@ hosts.each do |host|
|
|
33
33
|
logger.debug("add TEST=1")
|
34
34
|
host.add_env_var("TEST", "1")
|
35
35
|
logger.debug("add TEST=1 again (shouldn't create duplicate entry)")
|
36
|
-
host.add_env_var("
|
37
|
-
logger.debug("add
|
38
|
-
host.add_env_var("
|
36
|
+
host.add_env_var("TEST", "1")
|
37
|
+
logger.debug("add TEST=2")
|
38
|
+
host.add_env_var("TEST", "2")
|
39
39
|
logger.debug("ensure that TEST env var has correct setting")
|
40
|
-
logger.debug("add
|
41
|
-
host.add_env_var("
|
40
|
+
logger.debug("add TEST=3")
|
41
|
+
host.add_env_var("TEST", "3")
|
42
42
|
logger.debug("ensure that TEST env var has correct setting")
|
43
|
-
val = host.get_env_var("
|
43
|
+
val = host.get_env_var("TEST")
|
44
44
|
assert_match(/TEST=3(;|:)2(;|:)1$/, val, "add_env_var can correctly add env vars")
|
45
45
|
end
|
46
46
|
|
47
47
|
step "#add_env_var : can preserve an environment between ssh connections"
|
48
48
|
hosts.each do |host|
|
49
|
-
host.clear_env_var("
|
49
|
+
host.clear_env_var("TEST")
|
50
50
|
logger.debug("add TEST=1")
|
51
51
|
host.add_env_var("TEST", "1")
|
52
52
|
logger.debug("add TEST=1 again (shouldn't create duplicate entry)")
|
53
|
-
host.add_env_var("
|
54
|
-
logger.debug("add
|
55
|
-
host.add_env_var("
|
53
|
+
host.add_env_var("TEST", "1")
|
54
|
+
logger.debug("add TEST=2")
|
55
|
+
host.add_env_var("TEST", "2")
|
56
56
|
logger.debug("ensure that TEST env var has correct setting")
|
57
|
-
logger.debug("add
|
58
|
-
host.add_env_var("
|
57
|
+
logger.debug("add TEST=3")
|
58
|
+
host.add_env_var("TEST", "3")
|
59
59
|
logger.debug("close the connection")
|
60
60
|
host.close
|
61
61
|
logger.debug("ensure that TEST env var has correct setting")
|
62
|
-
val = host.get_env_var("
|
62
|
+
val = host.get_env_var("TEST")
|
63
63
|
assert_match(/TEST=3(;|:)2(;|:)1$/, val, "can preserve an environment between ssh connections")
|
64
64
|
end
|
65
65
|
|
@@ -67,15 +67,15 @@ step "#delete_env_var : can delete an environment"
|
|
67
67
|
hosts.each do |host|
|
68
68
|
logger.debug("remove TEST=3")
|
69
69
|
host.delete_env_var("TEST", "3")
|
70
|
-
val = host.get_env_var("
|
70
|
+
val = host.get_env_var("TEST")
|
71
71
|
assert_match(/TEST=2(;|:)1$/, val, "delete_env_var can correctly delete part of a chained env var")
|
72
72
|
logger.debug("remove TEST=1")
|
73
73
|
host.delete_env_var("TEST", "1")
|
74
|
-
val = host.get_env_var("
|
74
|
+
val = host.get_env_var("TEST")
|
75
75
|
assert_match(/TEST=2$/, val, "delete_env_var can correctly delete part of a chained env var")
|
76
76
|
logger.debug("remove TEST=2")
|
77
77
|
host.delete_env_var("TEST", "2")
|
78
|
-
val = host.get_env_var("
|
78
|
+
val = host.get_env_var("TEST")
|
79
79
|
assert_equal("", val, "delete_env_var fully removes empty env var")
|
80
80
|
end
|
81
81
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
test_name 'test generic installers'
|
2
|
+
|
3
|
+
confine :except, :platform => /^windows|osx/
|
4
|
+
|
5
|
+
step 'install arbitrary msi via url' do
|
6
|
+
hosts.each do |host|
|
7
|
+
if host['platform'] =~ /win/
|
8
|
+
# this should be implemented at the host/win/pkg.rb level someday
|
9
|
+
generic_install_msi_on(host, 'https://releases.hashicorp.com/vagrant/1.8.4/vagrant_1.8.4.msi', {}, {:debug => true})
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
step 'install arbitrary dmg via url' do
|
15
|
+
hosts.each do |host|
|
16
|
+
if host['platform'] =~ /osx/
|
17
|
+
host.generic_install_dmg('https://releases.hashicorp.com/vagrant/1.8.4/vagrant_1.8.4.dmg', 'Vagrant', 'Vagrant.pkg')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
test_name "validate host stubbing behavior"
|
2
|
+
|
3
|
+
def get_hosts_file(host)
|
4
|
+
if host['platform'] =~ /win/
|
5
|
+
hosts_file = "C:\\\\Windows\\\\System32\\\\Drivers\\\\etc\\\\hosts"
|
6
|
+
else
|
7
|
+
hosts_file = '/etc/hosts'
|
8
|
+
end
|
9
|
+
return hosts_file
|
10
|
+
end
|
11
|
+
|
12
|
+
step 'verify stub_host_on' do
|
13
|
+
step 'should add entry to hosts file' do
|
14
|
+
hosts.each do |host|
|
15
|
+
stub_hosts_on(host, { 'foo' => '1.1.1.1' }, { 'foo' => [ 'bar', 'baz' ] })
|
16
|
+
hosts_file = get_hosts_file(host)
|
17
|
+
result = on host, "cat #{hosts_file}"
|
18
|
+
assert_match %r{foo}, result.stdout
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
step 'stubbed value should be available for other steps in the test' do
|
23
|
+
hosts.each do |host|
|
24
|
+
hosts_file = get_hosts_file(host)
|
25
|
+
result = on host, "cat #{hosts_file}"
|
26
|
+
assert_match %r{foo}, result.stdout
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
step 'verify with_stub_host_on' do
|
32
|
+
step 'should add entry to hosts file' do
|
33
|
+
hosts.each do |host|
|
34
|
+
hosts_file = get_hosts_file(host)
|
35
|
+
result = with_host_stubbed_on(host, { 'sleepy' => '1.1.1.2' }, { 'sleepy' => [ 'grumpy', 'dopey' ] }) { on host, "cat #{hosts_file}" }
|
36
|
+
assert_match %r{sleepy}, result.stdout
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
step 'stubbed value should be reverted after the execution of the block' do
|
41
|
+
hosts.each do |host|
|
42
|
+
hosts_file = get_hosts_file(host)
|
43
|
+
result = on host, "cat #{hosts_file}"
|
44
|
+
assert_no_match %r{sleepy}, result.stdout
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/beaker.gemspec
CHANGED
@@ -27,12 +27,7 @@ Gem::Specification.new do |s|
|
|
27
27
|
|
28
28
|
# Documentation dependencies
|
29
29
|
s.add_development_dependency 'yard'
|
30
|
-
s.add_development_dependency 'markdown'
|
31
|
-
s.add_development_dependency 'thin'
|
32
30
|
|
33
|
-
# Temporary pin for gems no longer compatible with ruby 1.9.3
|
34
|
-
s.add_development_dependency 'activesupport', '~> 4.2'
|
35
|
-
s.add_development_dependency 'rack', '~> 1.6'
|
36
31
|
# Run time dependencies
|
37
32
|
s.add_runtime_dependency 'minitest', '~> 5.4'
|
38
33
|
s.add_runtime_dependency 'json', '~> 1.8'
|
@@ -55,7 +50,7 @@ Gem::Specification.new do |s|
|
|
55
50
|
s.add_runtime_dependency 'rbvmomi', '~> 1.8'
|
56
51
|
s.add_runtime_dependency 'fission', '~> 0.4'
|
57
52
|
s.add_runtime_dependency 'google-api-client', ['~> 0.8', '< 0.9.5'] # dropped ruby 1.9 rupport in 0.9.5
|
58
|
-
s.add_runtime_dependency 'aws-sdk', '~> 1.57'
|
53
|
+
s.add_runtime_dependency 'aws-sdk-v1', '~> 1.57'
|
59
54
|
s.add_runtime_dependency 'docker-api'
|
60
55
|
s.add_runtime_dependency 'mime-types', '~> 2.99' if RUBY_VERSION < '2.0' # dropped ruby 1.9 rupport in 3.0
|
61
56
|
s.add_runtime_dependency 'fog-google', '~> 0.0.9' # dropped ruby 1.9 support in 0.1
|
data/docs/README.md
CHANGED
@@ -1,36 +1,26 @@
|
|
1
1
|

|
2
2
|
|
3
|
-
|
3
|
+
Documentation for Beaker can be found in this repository in [the docs/ folder](README.md).
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
* [The Beaker DSL](The-Beaker-DSL.md)
|
18
|
-
* [Beaker DSL on rdoc.info](http://rdoc.info/github/puppetlabs/beaker/master/Beaker/DSL)
|
19
|
-
* [How the confine method works](dsl/confine.md)
|
20
|
-
* [Platform Specific Tag Confines](dsl/platform_specific_tag_confines.md)
|
21
|
-
* [Shared Options for Executing Beaker Commands](Shared-Options-for-Executing-Beaker-Commands.md)
|
22
|
-
* [Let's Write a Test!](Lets-Write-a-Test.md)
|
23
|
-
* [Access The Live Test Console with Pry](Access-the-Live-Test-Console-with-Pry.md)
|
24
|
-
* [Test Tagging](Beaker-Test-Tagging.md)
|
25
|
-
* [Recipes](Beaker-Recipes.md)
|
26
|
-
* [Beaker vs. Beaker-rspec](beaker-vs.-beaker-rspec.md)
|
27
|
-
* [How to Write a Beaker Test for a Module Using beaker-rspec](How-to-Write-a-Beaker-Test-for-a-Module.md)
|
28
|
-
* [Beaker Libraries](Beaker-Libraries.md)
|
5
|
+
## Table of Contents
|
6
|
+
|
7
|
+
- [Tutorials](tutorials) take you by the hand through the steps to setup a
|
8
|
+
beaker run. Start here if you’re new to Beaker or test development.
|
9
|
+
- [Concepts](concepts) discuss key topics and concepts at a fairly high
|
10
|
+
level and provide useful background information and explanation.
|
11
|
+
- [Rubydocs](http://rubydoc.info/github/puppetlabs/beaker/frames) contains the
|
12
|
+
technical reference for APIs and other aspects of Beaker. They describe how it
|
13
|
+
works and how to use it but assume that you have a basic understanding of key concepts.
|
14
|
+
- [How-to guides](how_to) are recipes. They guide you through the steps
|
15
|
+
involved in addressing key problems and use-cases. They are more advanced than
|
16
|
+
tutorials and assume some knowledge of how Beaker works.
|
29
17
|
|
30
18
|
## Other Resources
|
31
19
|
|
20
|
+
In addition to the overview above, which matches Beaker's main README docs section,
|
21
|
+
this doc's README has some links to other outside resources:
|
22
|
+
|
32
23
|
* [Latest Gem Release Notes](https://github.com/puppetlabs/beaker/blob/master/HISTORY.md#LATEST)
|
33
|
-
* [File a Beaker Bug](File-a-Beaker-Bug.md)
|
34
24
|
* [Video: Beaker 101 talk at PDXPUG, May 2014](https://www.youtube.com/watch?v=cSyJXTYFXFg)
|
35
25
|
* [Podcast: Beaker, May 2014](http://puppetlabs.com/podcasts/podcast-beaker-cloud-enabled-acceptance-testing-tool)
|
36
26
|
* [Podcast: Automated Testing with Beaker for Windows, December 2014](http://puppetlabs.com/podcasts/podcast-automated-testing-beaker-windows)
|
data/docs/{Argument-Processing-and-Precedence.md → concepts/argument_processing_and_precedence.md}
RENAMED
@@ -1,14 +1,14 @@
|
|
1
1
|
Beaker uses arguments and settings from a variety of sources to determine how your test run is executed.
|
2
2
|
|
3
|
-
* [Environment Variables](
|
4
|
-
* [Host/Config File Options](
|
5
|
-
* [ARGV](
|
6
|
-
* [Supported Command Line Arguments](
|
7
|
-
* [Options File Values](
|
8
|
-
* [Example Options File](
|
9
|
-
* [Default Values](
|
10
|
-
* [Beaker Default Values](
|
11
|
-
* [Priority of Settings](
|
3
|
+
* [Environment Variables](#environment-variables)
|
4
|
+
* [Host/Config File Options](#host-file-options)
|
5
|
+
* [ARGV](#argv-or-provided-arguments-array)
|
6
|
+
* [Supported Command Line Arguments](#supported-command-line-arguments)
|
7
|
+
* [Options File Values](#options-file-values)
|
8
|
+
* [Example Options File](#example-options-file)
|
9
|
+
* [Default Values](#default-values)
|
10
|
+
* [Beaker Default Values](#beaker-default-values)
|
11
|
+
* [Priority of Settings](#priority-of-settings)
|
12
12
|
|
13
13
|
|
14
14
|
## Environment Variables
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -42,7 +42,7 @@ Specifies standard input to be provided to the command post execution. Defaults
|
|
42
42
|
|
43
43
|
on host, "this command takes input", {:stdin => "hiya"}
|
44
44
|
|
45
|
-
## [:run_in_parallel](
|
45
|
+
## [:run_in_parallel](how_to/run_in_parallel.md)
|
46
46
|
|
47
47
|
Execute the command against all hosts in parallel
|
48
48
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# How to Preserve Hosts
|
2
|
+
|
3
|
+
## Motivation
|
4
|
+
|
5
|
+
Often when developing acceptance tests to be run with beaker, you'll want to be
|
6
|
+
able to quickly iterate on those tests in an already setup System Under Test
|
7
|
+
(SUT) configuration. Beaker provides the ability to do that using its preserved
|
8
|
+
hosts functionality.
|
9
|
+
|
10
|
+
## How Do I Use It?
|
11
|
+
|
12
|
+
Note that where you decide to use this option will affect its precedence. You
|
13
|
+
can learn more about this in our
|
14
|
+
[argument processing & precedence doc](../topics/argument_processing_and_precedence.md).
|
15
|
+
|
16
|
+
### Command-Line Option
|
17
|
+
|
18
|
+
The primary way that this option is provided is through the command line, where
|
19
|
+
it's represented by the `--preserved-hosts` option. It defaults to `never`, and
|
20
|
+
if you run `beaker --help`, you'll see the range of values that can be taken:
|
21
|
+
|
22
|
+
$ beaker --help
|
23
|
+
...
|
24
|
+
--preserve-hosts [MODE] How should SUTs be treated post test
|
25
|
+
Possible values:
|
26
|
+
always (keep SUTs alive)
|
27
|
+
onfail (keep SUTs alive if failures occur during testing)
|
28
|
+
onpass (keep SUTs alive if no failures occur during testing)
|
29
|
+
never (cleanup SUTs - shutdown and destroy any changes made during testing)
|
30
|
+
(default: never)
|
31
|
+
...
|
32
|
+
|
33
|
+
### Local Options or Global Config
|
34
|
+
|
35
|
+
You can also provide a value for this option wherever you can provide a value
|
36
|
+
that gets merged into beaker's global options hash. The two ways to do this are
|
37
|
+
to provide it in a local options file, or in the global `CONFIG` section of your
|
38
|
+
hosts file. To learn more about how to set these options, check out the
|
39
|
+
[Options File Values](../topics/argument_processing_and_precedence.md#options-file-values)
|
40
|
+
and the
|
41
|
+
[`CONFIG` Section of a Hosts File](../topics/argument_processing_and_precedence.md#config-section-of-hosts-file)
|
42
|
+
sections of the
|
43
|
+
[argument processing & precedence doc](../topics/argument_processing_and_precedence.md).
|
44
|
+
|
45
|
+
Either way, the underlying property name that you will have to set if you use
|
46
|
+
these options is `:preserve_hosts`.
|
47
|
+
|
48
|
+
## What Does It Do (In Detail)?
|
49
|
+
|
50
|
+
Using the preserved hosts functionality outputs a `hosts_preserved.yml` file into
|
51
|
+
the directory that holds all of the log files for a particular beaker run. The
|
52
|
+
short way to access that directory is to look into the `log/latest` path, which
|
53
|
+
is a symlink to the actual log directory for the run.
|
54
|
+
|
55
|
+
The `hosts_preserved.yml` file generated by a run differs from the original
|
56
|
+
hosts file passed into Beaker in a number of ways:
|
57
|
+
|
58
|
+
- all suites are emptied
|
59
|
+
- the host names are updated to point to the IPs (or hostnames) of the VMs since
|
60
|
+
they exist and no longer need provisioning
|
61
|
+
- the `provision` option is set to `false` (check
|
62
|
+
[Beaker Test Run's](../tutorials/test_run.md) provisioning section for details).
|
63
|
+
|
64
|
+
Beaker will also output the lines included below at the end of the run:
|
65
|
+
|
66
|
+
You can re-run commands against the already provisioned SUT(s) with:
|
67
|
+
/.../beaker --hosts log/centos7-64mdac-ubuntu1504-64a/2016-07-18_13_42_44/hosts_preserved.yml --tests smoke_simple.rb --preserve-hosts onpass
|
68
|
+
|
69
|
+
The important piece here is the hosts argument, in that it's informing you of
|
70
|
+
where the preserved hosts file is located. Of course, until you kick off another
|
71
|
+
beaker run, you can also reach this file with the `log/latest/hosts_preserved.yml`
|
72
|
+
symlink, as mentioned at the beginning of this section.
|
73
|
+
|
74
|
+
## What Do I Do With It?
|
75
|
+
|
76
|
+
For subsequent runs, if you want to set something, you'll have to pay attention
|
77
|
+
to the precedence of your arguments, to be sure that you are overriding what is
|
78
|
+
set in the preserved hosts file. Checkout the
|
79
|
+
[argument processing & precedence doc](../topics/argument_processing_and_precedence.md)
|
80
|
+
for more details on the precedence order of options parsing.
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# Rake test tasks for running beaker
|
2
|
+
|
3
|
+
## How does it work?
|
4
|
+
|
5
|
+
There are some rake tasks that you can use to run Beaker tests from your local project dir.
|
6
|
+
|
7
|
+
To use them from within your own project, you will need to require the following file in your project's rakefile:
|
8
|
+
|
9
|
+
require 'beaker/tasks/test'
|
10
|
+
|
11
|
+
You will also need to have Beaker installed as part of your bundle.
|
12
|
+
|
13
|
+
When you run:
|
14
|
+
|
15
|
+
rake --tasks
|
16
|
+
|
17
|
+
from your project dir, you should see (as well as any rake tasks you have defined locally)
|
18
|
+
|
19
|
+
rake beaker:test[hosts,type] # Run Beaker Acceptance
|
20
|
+
rake beaker:test:git[hosts] # Run Beaker Git tests
|
21
|
+
rake beaker:test:pe[hosts] # Run Beaker PE tests
|
22
|
+
|
23
|
+
The last two tasks assume that you have an options file in /acceptance named beaker-git.cfg and beaker-pe.cfg
|
24
|
+
respectively.
|
25
|
+
|
26
|
+
Your options file would look something like:
|
27
|
+
|
28
|
+
{
|
29
|
+
:type => 'git',
|
30
|
+
:pre_suite => ['./acceptance/setup/install.rb'],
|
31
|
+
:hosts_file => './acceptance/config/windows-2012r2-x86_64.cfg',
|
32
|
+
:log_level => 'debug',
|
33
|
+
:tests => ['./acceptance/tests/access_rights_directory', './acceptance/tests/identity',
|
34
|
+
'./acceptance/tests/owner', './acceptance/tests/propagation',
|
35
|
+
'./acceptance/tests/use_cases', './acceptance/tests/access_rights_file', './acceptance/tests/group',
|
36
|
+
'./acceptance/tests/inheritance', './acceptance/tests/parameter_target', './acceptance/tests/purge'],
|
37
|
+
:keyfile => '~/.ssh/id_rsa-acceptance',
|
38
|
+
:timeout => 6000
|
39
|
+
}
|
40
|
+
|
41
|
+
To use the more generic test task, you will need to pass in the type as the 2nd argument to the rake task:
|
42
|
+
|
43
|
+
rake beaker:test[,smoke]
|
44
|
+
|
45
|
+
This will assume that you have created the file:
|
46
|
+
|
47
|
+
acceptance/beaker-smoke.cfg
|
48
|
+
|
49
|
+
|