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
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/docs/{How-to-Write-a-Beaker-Test-for-a-Module.md → how_to/write_a_beaker_test_for_a_module.md}
RENAMED
@@ -1,11 +1,11 @@
|
|
1
1
|
#Beaker for Modules
|
2
2
|
##Read the Beaker Docs
|
3
3
|
|
4
|
-
[Beaker How To](
|
4
|
+
[Beaker How To](../tutorials/how_to_beaker.md)
|
5
5
|
[Beaker DSL API](http://rubydoc.info/github/puppetlabs/beaker/frames)
|
6
6
|
|
7
7
|
##Understand the Difference Between beaker and beaker-rspec
|
8
|
-
[beaker vs. beaker-rspec](
|
8
|
+
[beaker vs. beaker-rspec](../concepts/beaker_vs_beaker_rspec.md)
|
9
9
|
|
10
10
|
##beaker-rspec Details
|
11
11
|
See the [beaker-rspec README](https://github.com/puppetlabs/beaker-rspec/blob/master/README.md) for details on how to use beaker-rspec with modules.
|
@@ -1,4 +1,7 @@
|
|
1
|
-
Hosts/Nodes/SUTs are defined in the --hosts (--config) file in Yaml format.
|
1
|
+
Hosts/Nodes/SUTs are defined in the --hosts (--config) file in Yaml format.
|
2
|
+
This file defines each node in the test configuration. The file can be saved
|
3
|
+
anywhere and used with `beaker --hosts yourhost.yaml`
|
4
|
+
(see [The Command Line](the_command_line.md) for more info).
|
2
5
|
|
3
6
|
Example hosts file:
|
4
7
|
|
@@ -81,12 +84,12 @@ The platform's format is `/^OSFAMILY-VERSION-ARCH.*$/` where `OSFAMILY` is one o
|
|
81
84
|
`VERSION`'s format is not enforced, but should reflect the `OSFAMILY` selected (ie, ubuntu-1204-i386-master, scientific-6-i386-agent, etc). `ARCH`'s format is also not enforced, but should be appropriate to the `OSFAMILY` selected (ie, ubuntu-1204-i386-master, sles-11-x86_64-master, debian-7-amd64-master, etc).
|
82
85
|
|
83
86
|
## Supported Virtualization Providers ##
|
84
|
-
* [AWS](hypervisors/aws.md)
|
85
|
-
* [VMWare Fusion](hypervisors/vmware_fusion.md)
|
86
|
-
* [EC2](hypervisors/ec2.md)
|
87
|
-
* [vSphere](hypervisors/vsphere.md)
|
88
|
-
* [Vagrant](hypervisors/vagrant.md)
|
89
|
-
* [Google Compute Engine](hypervisors/google_compute_engine.md)
|
90
|
-
* [Docker Support](hypervisors/docker.md)
|
91
|
-
* [Openstack](hypervisors/openstack.md)
|
92
|
-
* [Solaris](hypervisors/solaris.md)
|
87
|
+
* [AWS](../how_to/hypervisors/aws.md)
|
88
|
+
* [VMWare Fusion](../how_to/hypervisors/vmware_fusion.md)
|
89
|
+
* [EC2](../how_to/hypervisors/ec2.md)
|
90
|
+
* [vSphere](../how_to/hypervisors/vsphere.md)
|
91
|
+
* [Vagrant](../how_to/hypervisors/vagrant.md)
|
92
|
+
* [Google Compute Engine](../how_to/hypervisors/google_compute_engine.md)
|
93
|
+
* [Docker Support](../how_to/hypervisors/docker.md)
|
94
|
+
* [Openstack](../how_to/hypervisors/openstack.md)
|
95
|
+
* [Solaris](../how_to/hypervisors/solaris.md)
|
@@ -0,0 +1,6 @@
|
|
1
|
+
* [Beaker Installation](installation.md)
|
2
|
+
* [Creating A Test Environment](creating_a_test_environment.md)
|
3
|
+
* [The Command Line](the_command_line.md)
|
4
|
+
* [The Beaker DSL](../how_to/the_beaker_dsl.md)
|
5
|
+
* [Let's Write a Test!](lets_write_a_test.md)
|
6
|
+
* [Access The Live Test Console with Pry](../how_to/access_the_live_test_console_with_pry.md)
|
File without changes
|
@@ -1,8 +1,8 @@
|
|
1
|
-
|
1
|
+
##The Task
|
2
2
|
|
3
3
|
Consider if mcollectived incorrectly spawned a new process with every puppet agent run on Ubuntu 10.04. We need an acceptance test to check that a new process is not spawned and to ensure that this issue does not regress in new builds.
|
4
4
|
|
5
|
-
|
5
|
+
##Figure Out Test Steps
|
6
6
|
|
7
7
|
What needs to happen in this test:
|
8
8
|
|
@@ -10,7 +10,10 @@ What needs to happen in this test:
|
|
10
10
|
* Restart mcollective twice
|
11
11
|
* Check to see if more than one mcollective process is running
|
12
12
|
|
13
|
-
|
13
|
+
##Create a host configuration file
|
14
|
+
$ beaker-hostgenerator redhat7-64ma > redhat7-64ma.yaml
|
15
|
+
|
16
|
+
##Install PE
|
14
17
|
|
15
18
|
We prefer to install PE once and then run a set of tests, so PE installation should not be part of the actual acceptance test.
|
16
19
|
|
@@ -18,11 +21,12 @@ We prefer to install PE once and then run a set of tests, so PE installation sho
|
|
18
21
|
$ cd setup
|
19
22
|
$ cat > install.rb << RUBY
|
20
23
|
test_name "Installing Puppet Enterprise" do
|
21
|
-
install_pe
|
24
|
+
install_pe
|
22
25
|
RUBY
|
23
26
|
$ cd ..
|
24
27
|
|
25
|
-
|
28
|
+
This places our install steps in a ruby script (install.rb) which will run on localhost, but the #install_pe method knows where to install puppet enterprise based on the host configuration in use.
|
29
|
+
The install.rb script is used in our commandline to beaker, below.
|
26
30
|
|
27
31
|
## Create a test file
|
28
32
|
|
@@ -38,13 +42,14 @@ Here's our magic command that restarts mcollective:
|
|
38
42
|
####Check to see if more than one mcollective process is running
|
39
43
|
|
40
44
|
Here's our magic command that throws an error if more than one mcollective process is running:
|
41
|
-
|
42
|
-
process_count_check = "bash -c '[[ $(ps auxww | grep [m]collectived | wc -l) -eq 1 ]]'"
|
43
|
-
|
45
|
+
|
46
|
+
process_count_check = "bash -c '[[ $(ps auxww | grep [m]collectived | wc -l) -eq 1 ]]'"
|
47
|
+
|
44
48
|
###Put it all together
|
45
49
|
|
46
50
|
Here's the finished acceptance test.
|
47
|
-
|
51
|
+
|
52
|
+
```ruby
|
48
53
|
test_name "/etc/init.d/pe-mcollective restart check"
|
49
54
|
|
50
55
|
# Don't run these tests on the following platforms
|
@@ -66,8 +71,10 @@ hosts.each do |host|
|
|
66
71
|
on(host, process_count_check) { assert_equal(0, exit_code) }
|
67
72
|
end
|
68
73
|
```
|
74
|
+
|
75
|
+
## Run it!
|
69
76
|
You can now run this with
|
70
77
|
|
71
|
-
|
78
|
+
beaker --host redhat7-64ma.yaml --pre-suite install.rb --test mytest.rb
|
72
79
|
|
73
|
-
Next up you may want to look at the [Beaker test for a module](
|
80
|
+
Next up you may want to look at the [Beaker test for a module](../how_to/write_a_beaker_test_for_a_module.md) page.
|
File without changes
|
File without changes
|
File without changes
|
@@ -224,6 +224,45 @@ module Beaker
|
|
224
224
|
end
|
225
225
|
end
|
226
226
|
|
227
|
+
# Copy a remote file to the local system and save it under a directory
|
228
|
+
# meant for storing SUT files to be viewed in the event of test failures.
|
229
|
+
#
|
230
|
+
# Files are stored locally with the following structure:
|
231
|
+
# ./<archive_root>/<hostname>/<from_path>
|
232
|
+
#
|
233
|
+
# This can be used during the post-suite phase to persist relevant log
|
234
|
+
# files from the SUTs so they can available with the test results
|
235
|
+
# (without having to preserve the SUT host and SSH in after the fact).
|
236
|
+
#
|
237
|
+
# Example
|
238
|
+
#
|
239
|
+
# Archive the Puppet Server log file from the master ('abc123'),
|
240
|
+
# and archive the Puppet Agent log file from the agent ('xyz098'):
|
241
|
+
#
|
242
|
+
# archive_file_from(master, '/var/log/puppetlabs/puppetserver.log')
|
243
|
+
# archive_file_from(agent, '/var/log/puppetlabs/puppetagent.log')
|
244
|
+
#
|
245
|
+
# Results in the following files on the test runner:
|
246
|
+
#
|
247
|
+
# archive/sut-files/abc123/var/log/puppetlabs/puppetserver.log
|
248
|
+
# archive/sut-files/xyz098/var/log/puppetlabs/puppetagent.log
|
249
|
+
#
|
250
|
+
# @param [Host] host A host object (or some object that can be passed to
|
251
|
+
# #scp_from)
|
252
|
+
# @param [String] from_path A remote absolute path on the host to copy.
|
253
|
+
# @!macro common_opts
|
254
|
+
# @option [String] archive_root The local directory to store the copied
|
255
|
+
# file under. Defaults to
|
256
|
+
# 'archive/sut-files'.
|
257
|
+
#
|
258
|
+
# @return [Result] Returns the result of the #scp_from operation.
|
259
|
+
def archive_file_from(host, from_path, opts = {}, archive_root = 'archive/sut-files')
|
260
|
+
filedir = File.dirname(from_path)
|
261
|
+
targetdir = File.join(archive_root, host.hostname, filedir)
|
262
|
+
FileUtils.mkdir_p(targetdir)
|
263
|
+
scp_from(host, from_path, targetdir, opts)
|
264
|
+
end
|
265
|
+
|
227
266
|
# Deploy packaging configurations generated by
|
228
267
|
# https://github.com/puppetlabs/packaging to a host.
|
229
268
|
#
|
@@ -505,13 +505,22 @@ module Beaker
|
|
505
505
|
# or a role (String or Symbol) that identifies one or more hosts.
|
506
506
|
# @param ip_spec [Hash{String=>String}] a hash containing the host to ip
|
507
507
|
# mappings
|
508
|
-
# @
|
509
|
-
#
|
510
|
-
|
508
|
+
# @param alias_spec [Hash{String=>Array[String]] an hash containing the host to alias(es) mappings to apply
|
509
|
+
# @example Stub puppetlabs.com on the master to 127.0.0.1 with an alias example.com
|
510
|
+
# stub_hosts_on(master, {'puppetlabs.com' => '127.0.0.1'}, {'puppetlabs.com' => ['example.com']})
|
511
|
+
def stub_hosts_on(machine, ip_spec, alias_spec={})
|
511
512
|
block_on machine do | host |
|
512
513
|
ip_spec.each do |address, ip|
|
514
|
+
aliases = alias_spec[address] || []
|
515
|
+
manifest =<<-EOS.gsub /^\s+/, ""
|
516
|
+
host { '#{address}':
|
517
|
+
\tensure => present,
|
518
|
+
\tip => '#{ip}',
|
519
|
+
\thost_aliases => #{aliases},
|
520
|
+
}
|
521
|
+
EOS
|
513
522
|
logger.notify("Stubbing address #{address} to IP #{ip} on machine #{host}")
|
514
|
-
|
523
|
+
apply_manifest_on( host, manifest )
|
515
524
|
end
|
516
525
|
|
517
526
|
teardown do
|
@@ -530,17 +539,15 @@ module Beaker
|
|
530
539
|
# or a role (String or Symbol) that identifies one or more hosts.
|
531
540
|
# @param ip_spec [Hash{String=>String}] a hash containing the host to ip
|
532
541
|
# mappings
|
533
|
-
# @
|
534
|
-
#
|
542
|
+
# @param alias_spec [Hash{String=>Array[String]] an hash containing the host to alias(es) mappings to apply
|
543
|
+
# @example Stub forgeapi.puppetlabs.com on the master to 127.0.0.1 with an alias forgeapi.example.com
|
544
|
+
# with_host_stubbed_on(master, {'forgeapi.puppetlabs.com' => '127.0.0.1'}, {'forgeapi.puppetlabs.com' => ['forgeapi.example.com']}) do
|
535
545
|
# puppet( "module install puppetlabs-stdlib" )
|
536
546
|
# end
|
537
|
-
def with_host_stubbed_on(host, ip_spec, &block)
|
547
|
+
def with_host_stubbed_on(host, ip_spec, alias_spec={}, &block)
|
538
548
|
begin
|
539
549
|
block_on host do |host|
|
540
|
-
ip_spec
|
541
|
-
logger.notify("Stubbing address #{address} to IP #{ip} on machine #{host}")
|
542
|
-
on( host, puppet('resource', 'host', address, 'ensure=present', "ip=#{ip}") )
|
543
|
-
end
|
550
|
+
stub_hosts_on(host, ip_spec, alias_spec)
|
544
551
|
end
|
545
552
|
|
546
553
|
block.call
|
@@ -574,11 +581,11 @@ module Beaker
|
|
574
581
|
# global options hash
|
575
582
|
def stub_forge_on(machine, forge_host = nil)
|
576
583
|
#use global options hash
|
584
|
+
primary_forge_name = 'forge.puppetlabs.com'
|
577
585
|
forge_host ||= options[:forge_host]
|
578
586
|
@forge_ip ||= Resolv.getaddress(forge_host)
|
579
587
|
block_on machine do | host |
|
580
|
-
stub_hosts_on(host, 'forge.puppetlabs.com'
|
581
|
-
stub_hosts_on(host, 'forgeapi.puppetlabs.com' => @forge_ip)
|
588
|
+
stub_hosts_on(host, {primary_forge_name => @forge_ip}, {primary_forge_name => ['forge.puppet.com','forgeapi.puppetlabs.com','forgeapi.puppet.com']})
|
582
589
|
end
|
583
590
|
end
|
584
591
|
|
@@ -593,12 +600,10 @@ module Beaker
|
|
593
600
|
# global options hash
|
594
601
|
def with_forge_stubbed_on( host, forge_host = nil, &block )
|
595
602
|
#use global options hash
|
603
|
+
primary_forge_name = 'forge.puppetlabs.com'
|
596
604
|
forge_host ||= options[:forge_host]
|
597
605
|
@forge_ip ||= Resolv.getaddress(forge_host)
|
598
|
-
with_host_stubbed_on( host,
|
599
|
-
{'forge.puppetlabs.com' => @forge_ip,
|
600
|
-
'forgeapi.puppetlabs.com' => @forge_ip},
|
601
|
-
&block )
|
606
|
+
with_host_stubbed_on( host, {primary_forge_name => @forge_ip}, {primary_forge_name => ['forge.puppet.com','forgeapi.puppetlabs.com','forgeapi.puppet.com']}, &block )
|
602
607
|
end
|
603
608
|
|
604
609
|
# This wraps `with_forge_stubbed_on` and provides it the default host
|
@@ -1081,21 +1081,29 @@ module Beaker
|
|
1081
1081
|
|
1082
1082
|
case variant
|
1083
1083
|
when /^(fedora|el|centos|debian|ubuntu|cumulus|huaweios|cisco_nexus|cisco_ios_xr)$/
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1084
|
+
if arch == 's390x'
|
1085
|
+
logger.trace("#install_puppet_agent_dev_repo_on: s390x arch detected for host #{host}. using dev package")
|
1086
|
+
else
|
1087
|
+
sha = opts[:puppet_agent_sha] || opts[:puppet_agent_version]
|
1088
|
+
opts[:dev_builds_repos] ||= [ opts[:puppet_collection] ]
|
1089
|
+
install_puppetlabs_dev_repo( host, 'puppet-agent', sha, nil, opts )
|
1090
|
+
host.install_package('puppet-agent')
|
1091
|
+
logger.trace("#install_puppet_agent_dev_repo_on: install_puppetlabs_dev_repo finished")
|
1092
|
+
next
|
1093
|
+
end
|
1090
1094
|
when /^(eos|osx|windows|solaris|sles|aix)$/
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
logger.trace("#install_puppet_agent_dev_repo_on: dev_package_info, continuing...")
|
1095
|
+
# Download installer package file & run install manually.
|
1096
|
+
# Done below, so that el hosts with s390x arch can use this
|
1097
|
+
# workflow as well
|
1095
1098
|
else
|
1096
1099
|
raise "No repository installation step for #{variant} yet..."
|
1097
1100
|
end
|
1098
1101
|
|
1102
|
+
release_path_end, release_file = host.puppet_agent_dev_package_info(
|
1103
|
+
opts[:puppet_collection], opts[:puppet_agent_version], opts )
|
1104
|
+
release_path << release_path_end
|
1105
|
+
logger.trace("#install_puppet_agent_dev_repo_on: dev_package_info, continuing...")
|
1106
|
+
|
1099
1107
|
if host['platform'] =~ /eos/
|
1100
1108
|
host.get_remote_file( "#{release_path}/#{release_file}" )
|
1101
1109
|
else
|
@@ -1107,7 +1115,7 @@ module Beaker
|
|
1107
1115
|
case variant
|
1108
1116
|
when /^eos/
|
1109
1117
|
host.install_from_file( release_file )
|
1110
|
-
when /^(sles|aix)$/
|
1118
|
+
when /^(sles|aix|el)$/
|
1111
1119
|
# NOTE: AIX does not support repo management. This block assumes
|
1112
1120
|
# that the desired rpm has been mirrored to the 'repos' location.
|
1113
1121
|
on host, "rpm -ivh #{onhost_copied_file}"
|
@@ -152,6 +152,45 @@ exit /B %errorlevel%
|
|
152
152
|
end
|
153
153
|
end
|
154
154
|
|
155
|
+
# Installs a specified msi path on given hosts
|
156
|
+
# @param [Host, Array<Host>, String, Symbol] hosts One or more hosts to act upon,
|
157
|
+
# or a role (String or Symbol) that identifies one or more hosts.
|
158
|
+
# @param [String] msi_path The path of the MSI - can be a local Windows style file path like
|
159
|
+
# c:\temp\foo.msi OR a url like https://download.com/foo.msi or file://c:\temp\foo.msi
|
160
|
+
# @param [Hash{String=>String}] msi_opts MSI installer options
|
161
|
+
# @option opts [Boolean] :debug output the MSI installation log when set to true
|
162
|
+
# otherwise do not output log (false; default behavior)
|
163
|
+
#
|
164
|
+
# @example
|
165
|
+
# generic_install_msi_on(hosts, 'https://releases.hashicorp.com/vagrant/1.8.4/vagrant_1.8.4.msi', {}, {:debug => true})
|
166
|
+
#
|
167
|
+
# @api private
|
168
|
+
def generic_install_msi_on(hosts, msi_path, msi_opts = {}, opts = {})
|
169
|
+
block_on hosts do | host |
|
170
|
+
batch_path, log_file = create_install_msi_batch_on(host, msi_path, msi_opts)
|
171
|
+
|
172
|
+
# begin / rescue here so that we can reuse existing error msg propagation
|
173
|
+
begin
|
174
|
+
# 1641 = ERROR_SUCCESS_REBOOT_INITIATED
|
175
|
+
# 3010 = ERROR_SUCCESS_REBOOT_REQUIRED
|
176
|
+
on host, Command.new("\"#{batch_path}\"", [], { :cmdexe => true }), :acceptable_exit_codes => [0, 1641, 3010]
|
177
|
+
rescue
|
178
|
+
on host, Command.new("type \"#{log_file}\"", [], { :cmdexe => true })
|
179
|
+
raise
|
180
|
+
end
|
181
|
+
|
182
|
+
if opts[:debug]
|
183
|
+
on host, Command.new("type \"#{log_file}\"", [], { :cmdexe => true })
|
184
|
+
end
|
185
|
+
|
186
|
+
if !host.is_cygwin?
|
187
|
+
# HACK: for some reason, post install we need to refresh the connection to make puppet available for execution
|
188
|
+
host.close
|
189
|
+
end
|
190
|
+
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
155
194
|
end
|
156
195
|
end
|
157
196
|
end
|
data/lib/beaker/host/mac/pkg.rb
CHANGED
@@ -6,8 +6,26 @@ module Mac::Pkg
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def install_package(name, cmdline_args = '', version = nil)
|
9
|
-
|
10
|
-
|
9
|
+
generic_install_dmg("#{name}.dmg", name, "#{name}.pkg")
|
10
|
+
end
|
11
|
+
|
12
|
+
# Install a package from a specified dmg
|
13
|
+
#
|
14
|
+
# @param [String] dmg_file The dmg file, including path if not
|
15
|
+
# relative. Can be a URL.
|
16
|
+
# @param [String] pkg_base The base name of the directory that the dmg
|
17
|
+
# attaches to under `/Volumes`
|
18
|
+
# @param [String] pkg_name The name of the package file that should be
|
19
|
+
# used by the installer
|
20
|
+
# @example: Install vagrant from URL
|
21
|
+
# mymachost.generic_install_dmg('https://releases.hashicorp.com/vagrant/1.8.4/vagrant_1.8.4.dmg', 'Vagrant', 'Vagrant.pkg')
|
22
|
+
def generic_install_dmg(dmg_file, pkg_base, pkg_name)
|
23
|
+
execute("test -f #{dmg_file}", :accept_all_exit_codes => true) do |result|
|
24
|
+
execute("curl -O #{dmg_file}") unless result.exit_code == 0
|
25
|
+
end
|
26
|
+
dmg_name = File.basename(dmg_file, '.dmg')
|
27
|
+
execute("hdiutil attach #{dmg_name}.dmg")
|
28
|
+
execute("installer -pkg /Volumes/#{pkg_base}/#{pkg_name} -target /")
|
11
29
|
end
|
12
30
|
|
13
31
|
def uninstall_package(name, cmdline_args = '')
|
@@ -99,7 +99,7 @@ module Unix::Exec
|
|
99
99
|
#@example
|
100
100
|
# host.add_env_var('PATH', '/usr/bin:PATH')
|
101
101
|
def add_env_var key, val
|
102
|
-
key = key.to_s
|
102
|
+
key = key.to_s
|
103
103
|
env_file = self[:ssh_env_file]
|
104
104
|
escaped_val = Regexp.escape(val).gsub('/', '\/').gsub(';', '\;')
|
105
105
|
#see if the key/value pair already exists
|
@@ -122,7 +122,7 @@ module Unix::Exec
|
|
122
122
|
#@example
|
123
123
|
# host.delete_env_var('PATH', '/usr/bin:PATH')
|
124
124
|
def delete_env_var key, val
|
125
|
-
key = key.to_s
|
125
|
+
key = key.to_s
|
126
126
|
env_file = self[:ssh_env_file]
|
127
127
|
val = Regexp.escape(val).gsub('/', '\/').gsub(';', '\;')
|
128
128
|
#if the key only has that single value remove the entire line
|
@@ -141,7 +141,7 @@ module Unix::Exec
|
|
141
141
|
#@example
|
142
142
|
# host.get_env_var('path')
|
143
143
|
def get_env_var key
|
144
|
-
key = key.to_s
|
144
|
+
key = key.to_s
|
145
145
|
exec(Beaker::Command.new("env | grep #{key}"), :accept_all_exit_codes => true).stdout.chomp
|
146
146
|
end
|
147
147
|
|
@@ -150,7 +150,7 @@ module Unix::Exec
|
|
150
150
|
#@example
|
151
151
|
# host.clear_env_var('PATH')
|
152
152
|
def clear_env_var key
|
153
|
-
key = key.to_s
|
153
|
+
key = key.to_s
|
154
154
|
env_file = self[:ssh_env_file]
|
155
155
|
#remove entire line
|
156
156
|
exec(Beaker::SedCommand.new(self['platform'], "/#{key}=.*$/d", env_file))
|
data/lib/beaker/host/unix/pkg.rb
CHANGED
@@ -384,7 +384,7 @@ module Unix::Pkg
|
|
384
384
|
when /^(solaris)$/
|
385
385
|
release_path_end, release_file = solaris_puppet_agent_dev_package_info(
|
386
386
|
puppet_collection, puppet_agent_version, opts )
|
387
|
-
when /^(sles|aix)$/
|
387
|
+
when /^(sles|aix|el)$/
|
388
388
|
arch = 'ppc' if variant == 'aix' && arch == 'power'
|
389
389
|
release_path_end = "#{variant}/#{version}/#{puppet_collection}/#{arch}"
|
390
390
|
release_file = "puppet-agent-#{puppet_agent_version}-1.#{variant}#{version}.#{arch}.rpm"
|
data/lib/beaker/test_suite.rb
CHANGED
@@ -140,11 +140,18 @@ module Beaker
|
|
140
140
|
#A convenience method for printing the results of a {TestCase}
|
141
141
|
#@param [TestCase] test_case The {TestCase} to examine and print results for
|
142
142
|
def print_test_result(test_case)
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
143
|
+
if test_case.exception
|
144
|
+
test_file_trace = ""
|
145
|
+
test_case.exception.backtrace.each do |line|
|
146
|
+
if line.include?(test_case.path)
|
147
|
+
test_file_trace = "\r\n Test line: #{line}"
|
148
|
+
break
|
149
|
+
end
|
150
|
+
end if test_case.exception.backtrace && test_case.path
|
151
|
+
test_reported = "reported: #{test_case.exception.inspect}#{test_file_trace}"
|
152
|
+
else
|
153
|
+
test_case.test_status
|
154
|
+
end
|
148
155
|
@logger.notify " Test Case #{test_case.path} #{test_reported}"
|
149
156
|
end
|
150
157
|
|