beaker 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +17 -0
  3. data/.rspec +2 -0
  4. data/.simplecov +14 -0
  5. data/DOCUMENTING.md +167 -0
  6. data/Gemfile +3 -0
  7. data/LICENSE +17 -0
  8. data/README.md +332 -0
  9. data/Rakefile +121 -0
  10. data/beaker.gemspec +42 -0
  11. data/beaker.rb +10 -0
  12. data/bin/beaker +9 -0
  13. data/lib/beaker.rb +36 -0
  14. data/lib/beaker/answers.rb +29 -0
  15. data/lib/beaker/answers/version28.rb +104 -0
  16. data/lib/beaker/answers/version30.rb +194 -0
  17. data/lib/beaker/cli.rb +113 -0
  18. data/lib/beaker/command.rb +241 -0
  19. data/lib/beaker/command_factory.rb +21 -0
  20. data/lib/beaker/dsl.rb +85 -0
  21. data/lib/beaker/dsl/assertions.rb +87 -0
  22. data/lib/beaker/dsl/helpers.rb +625 -0
  23. data/lib/beaker/dsl/install_utils.rb +299 -0
  24. data/lib/beaker/dsl/outcomes.rb +99 -0
  25. data/lib/beaker/dsl/roles.rb +97 -0
  26. data/lib/beaker/dsl/structure.rb +63 -0
  27. data/lib/beaker/dsl/wrappers.rb +100 -0
  28. data/lib/beaker/host.rb +193 -0
  29. data/lib/beaker/host/aix.rb +15 -0
  30. data/lib/beaker/host/aix/file.rb +16 -0
  31. data/lib/beaker/host/aix/group.rb +35 -0
  32. data/lib/beaker/host/aix/user.rb +32 -0
  33. data/lib/beaker/host/unix.rb +54 -0
  34. data/lib/beaker/host/unix/exec.rb +15 -0
  35. data/lib/beaker/host/unix/file.rb +16 -0
  36. data/lib/beaker/host/unix/group.rb +40 -0
  37. data/lib/beaker/host/unix/pkg.rb +22 -0
  38. data/lib/beaker/host/unix/user.rb +32 -0
  39. data/lib/beaker/host/windows.rb +44 -0
  40. data/lib/beaker/host/windows/exec.rb +18 -0
  41. data/lib/beaker/host/windows/file.rb +15 -0
  42. data/lib/beaker/host/windows/group.rb +36 -0
  43. data/lib/beaker/host/windows/pkg.rb +26 -0
  44. data/lib/beaker/host/windows/user.rb +32 -0
  45. data/lib/beaker/hypervisor.rb +37 -0
  46. data/lib/beaker/hypervisor/aixer.rb +52 -0
  47. data/lib/beaker/hypervisor/blimper.rb +123 -0
  48. data/lib/beaker/hypervisor/fusion.rb +56 -0
  49. data/lib/beaker/hypervisor/solaris.rb +65 -0
  50. data/lib/beaker/hypervisor/vagrant.rb +118 -0
  51. data/lib/beaker/hypervisor/vcloud.rb +175 -0
  52. data/lib/beaker/hypervisor/vsphere.rb +80 -0
  53. data/lib/beaker/hypervisor/vsphere_helper.rb +200 -0
  54. data/lib/beaker/logger.rb +167 -0
  55. data/lib/beaker/network_manager.rb +73 -0
  56. data/lib/beaker/options_parsing.rb +323 -0
  57. data/lib/beaker/result.rb +55 -0
  58. data/lib/beaker/shared.rb +15 -0
  59. data/lib/beaker/shared/error_handler.rb +17 -0
  60. data/lib/beaker/shared/host_handler.rb +46 -0
  61. data/lib/beaker/shared/repetition.rb +28 -0
  62. data/lib/beaker/ssh_connection.rb +198 -0
  63. data/lib/beaker/test_case.rb +225 -0
  64. data/lib/beaker/test_config.rb +148 -0
  65. data/lib/beaker/test_suite.rb +288 -0
  66. data/lib/beaker/utils.rb +7 -0
  67. data/lib/beaker/utils/ntp_control.rb +42 -0
  68. data/lib/beaker/utils/repo_control.rb +92 -0
  69. data/lib/beaker/utils/setup_helper.rb +77 -0
  70. data/lib/beaker/utils/validator.rb +27 -0
  71. data/spec/beaker/command_spec.rb +94 -0
  72. data/spec/beaker/dsl/assertions_spec.rb +104 -0
  73. data/spec/beaker/dsl/helpers_spec.rb +230 -0
  74. data/spec/beaker/dsl/install_utils_spec.rb +70 -0
  75. data/spec/beaker/dsl/outcomes_spec.rb +43 -0
  76. data/spec/beaker/dsl/roles_spec.rb +86 -0
  77. data/spec/beaker/dsl/structure_spec.rb +60 -0
  78. data/spec/beaker/dsl/wrappers_spec.rb +52 -0
  79. data/spec/beaker/host_spec.rb +95 -0
  80. data/spec/beaker/logger_spec.rb +117 -0
  81. data/spec/beaker/options_parsing_spec.rb +37 -0
  82. data/spec/beaker/puppet_command_spec.rb +128 -0
  83. data/spec/beaker/ssh_connection_spec.rb +39 -0
  84. data/spec/beaker/test_case_spec.rb +6 -0
  85. data/spec/beaker/test_suite_spec.rb +44 -0
  86. data/spec/mocks_and_helpers.rb +34 -0
  87. data/spec/spec_helper.rb +15 -0
  88. metadata +359 -0
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ M2IyYWFiMWQxN2RhMTU1NTlmY2FjNDFhNjYzNDFiNmZiMDMyYzc1YQ==
5
+ data.tar.gz: !binary |-
6
+ YmIyMWI4NDYwZDkyZTRmNjJmMTFiODgyYzkxMjZmNTllYTFkY2Q0Ng==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ ZGQ0YjUxZWU5YzAzZjFjZDhmNzBmYWEyNjdkZDE3NTIwNDRlYjMxNmFkYmEy
10
+ ODc3ZmI0ZjU5MzI1NmQ2MjFiY2ZhNDczYjEyNGE1ZDA4OGYzYTk5ZTU2YmMy
11
+ NWVhOTMyMmZlYTg1NzRlYTU5YWZmNTk5MTNlODgzMDcwNWI2Mjk=
12
+ data.tar.gz: !binary |-
13
+ NTBlYjdiMjJmM2YyZWI2NDk1ZDZkYjEyYTdhNDc1OTkyYjhkMTI0MGViNTZi
14
+ N2NmNzAzZTU4MmE4N2ZjYTBkMzM0YzNlOWEyM2M1MTQ3YTYyNTA0MGFiNmNh
15
+ MTZhYTYyZTEyM2YwZGNhMjcwZWE3ODdjOTMwMWRjZTE3NzhmNzA=
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.swp
2
+ log/*
3
+ !.gitignore
4
+ junit
5
+ acceptance-tests
6
+ pkg
7
+ Gemfile.lock
8
+ options.rb
9
+ test.cfg
10
+ .yardoc
11
+ coverage
12
+ .bundle
13
+ .vendor
14
+ _vendor
15
+ !tmp/README
16
+ tmp/*
17
+ doc
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.simplecov ADDED
@@ -0,0 +1,14 @@
1
+ SimpleCov.configure do
2
+ add_filter 'spec/'
3
+ add_filter do |file|
4
+ file.lines_of_code < 10
5
+ end
6
+ add_group 'DSL', '/dsl'
7
+ add_group 'Host', '/host'
8
+ add_group 'Utils' do |file|
9
+ files = %w(cli.rb logger.rb options_parsing.rb test_config.rb utils/)
10
+ files.any? {|f| file.filename =~ Regexp.new( Regexp.quote(f) ) }
11
+ end
12
+ end
13
+
14
+ SimpleCov.start if ENV['COVERAGE']
data/DOCUMENTING.md ADDED
@@ -0,0 +1,167 @@
1
+
2
+ ## Contributing Documentation to Puppetlabs Test Harness ##
3
+
4
+
5
+ All inline documentation uses YARD, below is an example usage, a quick
6
+ summary of documentation expectations and finally a short reference
7
+ for those new to YARD.
8
+
9
+ They say a picture is worth a thousand words, hopefully this example will
10
+ be worth more than the 154 it’s composed of:
11
+ ```ruby
12
+
13
+ #
14
+ # @param [Array<Host>, Host, #execute] hosts The host(s) to act on
15
+ # @param [String] action The action to perform
16
+ # @param [Hash{Symbol=>String}] options The options hash
17
+ # @option [Boolean] :noop (false) Set to true if you want noop mode
18
+ # @option [Boolean] :verbose (true) Whether or not to log verbosely
19
+ #
20
+ # @yield [result] Yields the result of action for further checking
21
+ # @yieldparam [Result] result A ValueObject containing action stats
22
+ # @return [void] This method is a helper for remotely executing tasks
23
+ #
24
+ # @example Use this method when action must be sudone
25
+ # sudo_with_logging( master, ‘reboot -r’, :verbose => false )
26
+ #
27
+ # @example Pass this a block to perform additional checks
28
+ # sudo_with_logging( master, ‘apt-get update’ ) do |result|
29
+ # if result.exit_code == 1
30
+ # fail_test( ‘Apt has failed us again!’ )
31
+ # end
32
+ # end
33
+ #
34
+ # @see TestCase#on
35
+ # @api dsl
36
+ #
37
+ def sudo_with_logging hosts, action, options = {}, &block
38
+ return if options[:noop]
39
+
40
+ if hosts.is_a?( Array )
41
+ hosts.each {|h| sudo_with_logging h, action, options, &block }
42
+ else
43
+ result = host.execute( action, options.delete(:verbose) )
44
+ yield result if block_given?
45
+ end
46
+ end
47
+
48
+ ```
49
+
50
+
51
+ ## Documentation Guide: ##
52
+
53
+
54
+ Most of our documentation is done with the @tag syntax. With a few
55
+ execptions tags follow this format:
56
+
57
+ @tag [TypeOfValueInBrackets] nameOfValue Multi-word description that
58
+ can span multiple lines, as long as lines after the first have
59
+ greater indentation
60
+
61
+ Note: The `tag` name and the `nameOfValue` in question cannot contain spaces.
62
+
63
+ All sections should be considered mandatory, but in practice a committer
64
+ can walk a contributor through the process and help ensure a high quality
65
+ of documentation. When contributing keep especially in mind that an
66
+ `@example` block will go a long way in helping understand the use case
67
+ (which also encourages use by others) and the @api tag helps to understand
68
+ the scope of a Pull Request.
69
+
70
+ Please be liberal with whitespace (not trailing whitespace) and vertical
71
+ alignment as it helps readability while “in code”. Default indentation
72
+ is two spaces unless there are readability/vertical alignment concerns.
73
+
74
+ While the `@params`, `@returns`, etc... may seem redundant they encourage
75
+ thinking through exactly what you are doing and because of their strict
76
+ format they allow a level of tooling not available in regular ruby.
77
+
78
+ You are encouraged to run the YARD documentation server locally by:
79
+
80
+ rake docs
81
+
82
+ or
83
+
84
+ rake docs:bg
85
+
86
+ depending on whether you want the server to run in the foreground or not
87
+
88
+ Wait for the documentation to compile and then point your browser to:
89
+
90
+ http://localhost:8808
91
+
92
+
93
+ ## A Simple YARD Reference: ##
94
+
95
+
96
+ A Hash that must be in `{:symbol => ‘string’}` format:
97
+
98
+ @param [Hash<Symbol, String>] my_hash
99
+
100
+ This is also valid, and maybe more obvious to those used to Ruby
101
+
102
+ @param [Hash{Symbol=>String}]
103
+
104
+ When specifying an options hash you use @option to specify key/values
105
+
106
+ @param [Hash{Symbol=>String}] my_opts An options hash
107
+ @option my_opts [ClassOfValue] :key_in_question A Description
108
+ @option my_opts [Fixnum] :log_level The log level to run in.
109
+ @option my_opts [Boolean] :turbo (true) Who doesn’t want turbos?
110
+
111
+ This parameter takes an unordered list of Strings, Fixnums, and Floats
112
+
113
+ @param [Array<String, Fixnum, Float>]
114
+
115
+ This is an ordered list of String, then Fixnum
116
+
117
+ @param [Array<(String, Fixnum)>]
118
+
119
+ This is a parameter that needs to implement certain methods
120
+
121
+ @param [#[], #to_s]
122
+
123
+ This documents that a method may return any of the types listed
124
+
125
+ @return [String, self, nil]
126
+
127
+ This is the return statement for a method only used for side effects
128
+
129
+ @return [void]
130
+
131
+ If a method returns a boolean (TrueClass or FalseClass) write:
132
+
133
+ @return [Boolean]
134
+
135
+ List possible classes that the method may raise:
136
+
137
+ @raise [Beaker::PendingTest]
138
+
139
+ List parameter names yielded by a method
140
+
141
+ @yield [result, self]
142
+
143
+ And specify what kind of object is yielded with this
144
+
145
+ @yieldparam [Result] result
146
+
147
+ An `example` block contains a tag, description and then indented code:
148
+
149
+ @example Accessing Host defaults using hash syntax
150
+ host[‘platform’] #=> ‘debian-6-amd64’
151
+
152
+ The `api` tag can have anything behind it, please use the following
153
+ when documenting harness methods:
154
+
155
+ @api dsl Part of the testing dsl used within tests
156
+ @api public Methods third party integrations can rely on
157
+ @api private Methods private to the harness, not to be used externally
158
+
159
+ When deprecating a method include information on newer alternatives
160
+
161
+ @deprecated This method is horrible. Please use {#foo} or {#bar}.
162
+
163
+ When you want to reference other information use
164
+
165
+ @see ClassOrModule
166
+ @see http://web.url.com/reference Title for the link
167
+
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,17 @@
1
+ beaker - Puppet's system level acceptance test harness
2
+
3
+ Copyright (C) 2011-2013 Puppet Labs Inc
4
+
5
+ Puppet Labs can be contacted at: info@puppetlabs.com
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,332 @@
1
+ # Running the Distributed Test Harness #
2
+
3
+ ## Install the harness on your 'Test Driver' ##
4
+ How to install the test harness on your workstation:
5
+
6
+ Pre-requisites: Ruby 1.8.7+
7
+
8
+ Automagically:
9
+
10
+ git clone https://github.com/puppetlabs/beaker.git
11
+ bundle install
12
+
13
+ Manually:
14
+
15
+ git clone https://github.com/puppetlabs/beaker.git
16
+ gem install rubygems net-ssh net-scp systemu
17
+
18
+
19
+ ## Configure Systems Under Test ##
20
+ Running Systest requires at least one 'System Under Test' (SUT) upon which to run tests.
21
+
22
+ System Under Test
23
+ - SUT may be physical, virtual; local or remote.
24
+ - The SUT will need a properly configured network and DNS or hosts file.
25
+ - On the SUT, you must configure pass through ssh auth for the root user.
26
+ - The SUT must have the "ntpdate" binary installed
27
+ - The SUT must have the "curl" binary installed
28
+ - On Windows, Cygwin must be installed (with curl, sshd, bash) and the necessary
29
+ windows gems (sys-admin, win32-dir, etc).
30
+ - FOSS install: you must have git, ruby, rdoc installed on your SUT.
31
+ - PE install: PE will install git, ruby, rdoc.
32
+
33
+
34
+ ## Prepare a Test Configuration File ##
35
+ - The test harness is configuration driven
36
+ - The config file is yaml formatted
37
+ - The type of insallation and configuration is dictated by the config file, especialy for PE
38
+
39
+ Here we have the host 'ubuntu-1004-64', a 64 bit Ubuntu box, serving as Puppet Master,
40
+ Dashboard, and Agent; the host "ubuntu-1004-32", a 32-bit Ubunutu node, will be a
41
+ Puppet Agent only. The Dashboard will be configured to run HTTPS on port 443.
42
+
43
+ HOSTS:
44
+ ubuntu-1004-64:
45
+ roles:
46
+ - master
47
+ - agent
48
+ - dashboard
49
+ platform: ubuntu-10.04-amd64
50
+ hypervisor: fusion
51
+ snapshot: clean
52
+ ubuntu-1004-32:
53
+ roles:
54
+ - agent
55
+ platform: ubuntu-10.04-i386
56
+ hypervisor: fusion
57
+ snaphost: clean
58
+ CONFIG:
59
+ consoleport: 443
60
+
61
+ You can setup a very different test scenario by simply re-arranging the "roles":
62
+
63
+ HOSTS:
64
+ ubuntu-1004-64:
65
+ roles:
66
+ - dashboard
67
+ - agent
68
+ platform: ubuntu-10.04-amd64
69
+ hypervisor: fusion
70
+ snapshot: clean
71
+ ubuntu-1004-32:
72
+ roles:
73
+ - master
74
+ - agent
75
+ platform: ubuntu-10.04-i386
76
+ hypervisor: fusion
77
+ snapshot: clean
78
+ CONFIG:
79
+ consoleport: 443
80
+
81
+ In this case, the host 'ubuntu-1004-32' is now the Puppet Master, while 'ubuntu-1004-64' is the
82
+ Puppet Dashboard host, resulting in a split Master/Dashboard install. Systest will automagically
83
+ prepare an appropriate answers file for use with the PE Installer.
84
+
85
+
86
+ # Provisioning #
87
+ Systest has built in capabilites for managing VMs and provisioning SUTs:
88
+
89
+ * VMWare vSphere via the RbVmomi gem
90
+ * VMWare Fusion via the Fission gem
91
+ * EC2 via blimpy
92
+ * Solaris zones via SSHing to the global zone
93
+ * Vagrant
94
+
95
+ You may mix and match hypervisors as needed. Hypervisors and snapshot names are defined per-host in the node configuration file. Default behavior for Vagrant, vSphere and EC2 is to powerdown/terminate test instances on a successful run. This can be altered with the `--preserve-hosts` option.
96
+ `--provision` indicates that you want to provision and revert VMs to snapshot before test execution, defaults to true. Use `--no-provision` to skip provisioning and reverting before test execution.
97
+
98
+
99
+ For example:
100
+
101
+
102
+ $ cat configs/my_hosts.yml
103
+ lucid-alpha:
104
+ roles:
105
+ - master
106
+ - agent
107
+ platform: ubuntu-10.04-i386
108
+ hypervisor: fusion
109
+ snapshot: foss
110
+ provision: false
111
+ shared-host-in-the-cloud:
112
+ roles:
113
+ - agent
114
+ platform: ubuntu-10.04-i386
115
+ hypervisor: vsphere
116
+ snaphost: base
117
+
118
+ $ ./beaker.rb --config configs/my_hosts.yml ....
119
+
120
+
121
+ ## VMWare Fusion support ##
122
+ Pre-requisite: Fission gem installed and configured, including a ~/.fissionrc
123
+ that points to the `vmrun` executable and where VMs can be found.
124
+ Example `.fissionrc` file (it's YAML):
125
+ ---
126
+ vm_dir: "/Directory/containing/my/.VMX/files"
127
+ vmrun_bin: "/Applications/VMware Fusion.app/Contents/Library/vmrun"
128
+
129
+ You can then use the following arguments in the node configuration:
130
+ - `hypervisor: fusion` tells us to enable this feature for this host. This is required.
131
+ - `snapshot: <name>`, where <name> is the snapshot name to revert to. This is required.
132
+
133
+ We'll try and match up the hostname with a VM of the same name. Note that the VM is expected to be pre-configured for running acceptance tests; it should have all the right prerequisite libraries, password-less SSH access for root, etc.
134
+
135
+ There are a few additional options available in your configuration file. Each host
136
+ section can now use:
137
+
138
+ - `vmname`: This is useful if the hostname of the VM doesn't match the name of
139
+ the .VMX file on disk. The alias should be something fission can load.
140
+
141
+
142
+ Example:
143
+
144
+ HOSTS:
145
+ pe-debian6:
146
+ roles:
147
+ - master
148
+ - agent
149
+ platform: debian-6-i386
150
+ vmname: super-awesome-vm-name
151
+ hypervisor: fusion
152
+ snapshot: acceptance-testing-5
153
+
154
+ Diagnostics:
155
+
156
+ When using `hypervisor fusion`, we'll log all the available VM names and for each
157
+ host we'll log all the available snapshot names.
158
+
159
+ ## EC2 Support ##
160
+ Pre-requisite: Blimpy gem installed and .fog file correctly configured with your credentials.
161
+
162
+ hypervisor: blimpy
163
+
164
+ Currently, there is limited support EC2 nodes; we are adding support for new platforms shortly.
165
+
166
+ AMIs are built for PE based installs on:
167
+ - Enterprize Linux 6, 64 and 32 bit
168
+ - Enterprize Linux 5, 32 bit
169
+ - Ubuntu 10.04, 32 bit
170
+
171
+ Systest will automagically provision EC2 nodes, provided the 'platform:' section of your config file lists a supported platform type: ubuntu-10.04-i386, el-6-x86_64, el-6-i386, el-5-i386.
172
+
173
+ ## Solaris Support ##
174
+
175
+ Used with `hypervisor: solaris`, the harness can connect to a Solaris host via SSH and revert zone snapshots.
176
+
177
+ Example .fog file:
178
+
179
+ :default:
180
+ :solaris_hypervisor_server: solaris.example.com
181
+ :solaris_hypervisor_username: harness
182
+ :solaris_hypervisor_keyfile: /home/jenkins/.ssh/id_rsa-harness
183
+ :solaris_hypervisor_vmpath: rpool/zoneds
184
+ :solaris_hypervisor_snappaths:
185
+ - rpool/ROOT/solaris
186
+
187
+ ## vSphere Support ##
188
+
189
+ The harness can use vms and snapshots that live within vSphere as well.
190
+ To do this create a `~/.fog` file with your vSphere credentials:
191
+
192
+ Example:
193
+
194
+ :default:
195
+ :vsphere_server: 'vsphere.example.com'
196
+ :vsphere_username: 'joe'
197
+ :vsphere_password: 'MyP@$$w0rd'
198
+
199
+
200
+ These follow the conventions used by Cloud Provisioner and Fog.
201
+
202
+ There are two possible `hypervisor` hypervisor-types to use for vSphere testing, `vsphere` and `vcloud`.
203
+
204
+ ### `hypervisor: vsphere`
205
+ This option locates an existing static VM, optionally reverts it to a pre-existing snapshot, and runs tests on it.
206
+
207
+ ### `hypervisor: vcloud`
208
+ This option clones a new VM from a pre-existing template, runs tests on the newly-provisioned clone, then deletes the clone once testing completes.
209
+
210
+ The `vcloud` option requires a slightly-modified test configuration file, specifying both the target template as well as three additional parameters in the 'CONFIG' section ('datastore', 'resourcepool', and 'folder').
211
+
212
+ HOSTS:
213
+ master-vm:
214
+ roles:
215
+ - master
216
+ - agent
217
+ - dashboard
218
+ platform: ubuntu-10.04-amd64
219
+ template: ubuntu-1004-x86_64
220
+ hypervisor: vcloud
221
+ agent-vm:
222
+ roles:
223
+ - agent
224
+ platform: ubuntu-10.04-i386
225
+ template: ubuntu-1004-i386
226
+ hypervisor: vcloud
227
+ CONFIG:
228
+ consoleport: 443
229
+ datastore: instance0
230
+ resourcepool: Delivery/Quality Assurance/FOSS/Dynamic
231
+ folder: delivery/Quality Assurance/FOSS/Dynamic
232
+
233
+
234
+ ## Vagrant support ##
235
+ The option allows for testing against local Vagrant boxes. As a prerequisite the Vagrant package (greather than 1.1) needs to installed - see <a href = "http://downloads.vagrantup.com/">downloads.vagrantup.com</a> for downloads.
236
+
237
+ The vm is identified by `box` or `box_url` in the config file. No snapshot name is required as the vm is reverted back to original state post testing using `vagrant destroy --force`.
238
+
239
+ HOSTS:
240
+ ubuntu-10-04-4-x64:
241
+ roles:
242
+ - master
243
+ - agent
244
+ - dashboard
245
+ - cloudpro
246
+ platform: ubuntu-10.04.4-x64
247
+ hypervisor: vagrant
248
+ box: ubuntu-server-10044-x64-vbox4210
249
+ box_url: http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-10044-x64-vbox4210.box
250
+ CONFIG:
251
+ nfs_server: none
252
+ consoleport: 443
253
+
254
+ # Putting it all together #
255
+
256
+ ## Running FOSS tests ##
257
+ Puppet FOSS Acceptance tests are stored in their respective Puppet repository, so
258
+ you must check out the tests first, then the harness, as such:
259
+
260
+ ### Checkout the tests
261
+ git://github.com/puppetlabs/puppet.git
262
+ cd puppet
263
+ ### Checkout the harness
264
+ git clone git://github.com/puppetlabs/beaker.git
265
+ cd beaker
266
+ ln -s ../acceptance acceptance-tests
267
+ ### Run the tests
268
+ ./beaker.rb -c ci/ci-${platform}.cfg --type git -p origin/2.7rc -f 1.5.8 -t acceptance-tests/tests --no-color --xml --debug --pre-suite setup/git/
269
+
270
+
271
+ ## Running PE tests ##
272
+
273
+ When performing a PE install, Systest expects to find PE tarballs and a LATEST file in /opt/enterprise/dists; the LATEST file
274
+ indicates the version string of the most recent tarball.
275
+
276
+ $ [topo@gigio ]$ cat /opt/enterprise/dists/LATEST
277
+ 2.5.3
278
+
279
+ $ [topo@gigio ]$ ls -1 /opt/enterprise/dists
280
+ LATEST
281
+ puppet-enterprise-2.5.3-debian-6-amd64.tar.gz
282
+ <snip>
283
+ puppet-enterprise-2.5.3-ubuntu-12.04-i386.tar.gz
284
+
285
+ You can also install from git. Use the `--install` option, which can install puppet along with other infrastructure. This option supports the following URI formats:
286
+
287
+ - `PATH`: A full and complete path to a git repository
288
+
289
+ --install git://github.com/puppetlabs/puppet#stable
290
+
291
+ - `KEYWORD/name`: The name of the branch of KEYWORD git repository. Supported keywords are `PUPPET`, `FACTER`, `HIERA` and `HIERA-PUPPET`.
292
+
293
+ --install PUPPET/3.1.0
294
+
295
+ ### Checkout your tests
296
+ git clone git@github.com:your/test_repo.git
297
+ cd test_repo
298
+ ### Checkout the harness
299
+ git clone git@github.com:puppetlabs/beaker.git
300
+ cd beaker
301
+ ### Pre-suite and Post-suite
302
+ The harness command line supports `--pre-suite` and `--post-suite`. `--pre-suite` describes steps to take after initial provisioning/configuring of the vms under test before the tests are run. `--post-suite` steps are run directly after tests.
303
+
304
+ Both options support directories, individual files and comma separated lists of directories and files. Given a directory it will look for files of the type `*.rb` within that directory. Steps will be run in the order they appear in on the command line. Directories of steps will be run in alphabetic order of the `*.rb` files within the directory.
305
+
306
+ --pre-suite setup/early/mystep.rb,setup/early/mydir
307
+ ### Run the tests
308
+ bundle exec beaker.rb -c your_config.cfg --type pe -t test_repo/tests --debug
309
+
310
+ ### Failure management
311
+ By default if a test fails the harness will move on and attempt the next test in the suite. This may be undesirable when debugging. The harness supports an optional `--fail-mode` to alter the default behavior on failure:
312
+
313
+ - `fast`: After first failure do not test any subsequent tests in the given suite, simply run cleanup steps and then exit gracefully. This option short circuits test execution while leaving you with a clean test environment for any follow up testing.
314
+
315
+ - `stop`: After first failure do not test any subsequent tests in the given suite, do not run any cleanup steps, exit immediately. This is useful while testing setup steps or if you plan to revert the test environment before every test.
316
+
317
+ ## Topic branches, special test repo
318
+ bundle exec beaker.rb -c your_cfg.cfg --debug --type git -p 2.7.x -f 1.5.8 -t path-to-your-tests
319
+
320
+ path-to-test:
321
+ If you are testing on FOSS, the test for each branch can be found in the puppet repo under acceptance/tests
322
+
323
+ Special topic branch checkout with a targeted test:
324
+
325
+ bundle exec beaker.rb -c your_cfg --type git -p https://github.com/SomeDude/puppet/tree/ticket/2.6.next/6856-dangling-symlinks -f 1.5.8 /
326
+
327
+
328
+ ## Making extensions to the harness using `--load-path`
329
+
330
+ You may need to extend the harness DSL (data specific language) to handle your particular test case. To run the harness with an addition to the LOAD_PATH use `--load-path`. You can specify a single directory or a comma separated list of directories to be added.
331
+
332
+ bundle exec beaker.rb --debug --config ubuntu1004-32mda.cfg --tests ../puppet/acceptance/tests/resource/cron/should_allow_changing_parameters.rb --fail fast --root-keys --type pe --load-path ../puppet/acceptance/lib/