beaker 3.22.0 → 3.23.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.
@@ -1,305 +0,0 @@
1
- ## What's Pry?
2
-
3
- [Pry](http://pryrepl.org/) is a powerful Ruby editing and debugging tool. Beaker uses Pry runtime invocation to create a developer console.
4
-
5
- ## Set it up!
6
-
7
- Pry is included in the Beaker 1.13+ development gems and is available by default.
8
-
9
- Pre-1.13.0 add Pry with `gem install pry`, then add Pry to individual tests by adding `require 'pry'` as the first line in the Ruby test file.
10
-
11
- ## Invoke the Developer Console
12
-
13
- In a Beaker test file call `binding.pry` to invoke the console. Place it where you want access to the full, current Beaker environment.
14
-
15
- ## Example
16
- ### Example test trypry.rb
17
- Here's a test file that exercises different ways of running commands on Beaker hosts. At the end of the main `hosts.each` loop I've included `binding.pry` to invoke the console.
18
-
19
- ```
20
- hosts.each do |h|
21
- on h, "echo hello"
22
- if h['platform'] =~ /windows/
23
- scp_to h, "beaker.gemspec", "/cygdrive/c/Documents\ and\ Settings/All\ Users/Application\ Data/"
24
- end
25
- on(h, "echo test block") do |result|
26
- puts "block result.stdout: #{result.stdout}"
27
- puts "block result.raw_stdout: #{result.raw_stdout}"
28
- end
29
- on(h, "echo test block, built in functions") do
30
- puts "built in function stdout: #{stdout}"
31
- puts "built in function stderr: #{stderr}"
32
- end
33
-
34
- result = on(h, "echo no block")
35
- puts "return var result.stdout: #{result.stdout}"
36
- puts "return var result.raw_stdout: #{result.raw_stdout}"
37
-
38
- binding.pry
39
-
40
- end
41
- ```
42
-
43
- ### Sample output to the first `binding.pry` call:
44
- ```
45
- $ bundle exec beaker --debug --tests tests/trypry.rb --hosts configs/fusion/winfusion.cfg --no-provi
46
- sion
47
- {
48
- "project": "Beaker",
49
- "department": "anode",
50
- "validate": true,
51
- "jenkins_build_url": null,
52
- "forge_host": "vulcan-acceptance.delivery.puppetlabs.net",
53
- "log_level": "debug",
54
- "trace_limit": 10,
55
- "hosts_file": "configs/fusion/winfusion.cfg",
56
- "options_file": null,
57
- "type": "pe",
58
- "provision": false,
59
- "preserve_hosts": "never",
60
- "root_keys": false,
61
- "quiet": false,
62
- "xml": false,
63
- "color": true,
64
- "dry_run": false,
65
- "timeout": 300,
66
- "fail_mode": "slow",
67
- "timesync": false,
68
- "repo_proxy": false,
69
- "add_el_extras": false,
70
- "add_master_entry": false,
71
- "consoleport": 443,
72
- "pe_dir": "http://neptune.puppetlabs.lan/3.2/ci-ready/",
73
- "pe_version_file": "LATEST",
74
- "pe_version_file_win": "LATEST-win",
75
- "dot_fog": "/Users/anode/.fog",
76
- "ec2_yaml": "config/image_templates/ec2.yaml",
77
- "help": false,
78
- "ssh": {
79
- "config": false,
80
- "paranoid": false,
81
- "timeout": 300,
82
- "auth_methods": [
83
- "publickey"
84
- ],
85
- "port": 22,
86
- "forward_agent": true,
87
- "keys": [
88
- "/Users/anode/.ssh/id_rsa"
89
- ],
90
- "user_known_hosts_file": "/Users/anode/.ssh/known_hosts"
91
- },
92
- "tests": [
93
- "tests/trypry.rb"
94
- ],
95
- "command_line": "/Users/anode/beaker/.bundle/gems/bin/beaker --debug --tests tests/trypry.rb --hosts configs/fusion/winfusion.cfg --no-provision",
96
- "HOSTS": {
97
- "pe-centos6": {
98
- "roles": [
99
- "master",
100
- "agent",
101
- "dashboard",
102
- "database"
103
- ],
104
- "platform": "el-6-i386",
105
- "snapshot": "clean-w-keys",
106
- "hypervisor": "fusion"
107
- },
108
- "w2k8r2": {
109
- "roles": [
110
- "agent"
111
- ],
112
- "platform": "windows-2008r2-x86_64",
113
- "snapshot": "clean-w-keys",
114
- "hypervisor": "fusion"
115
- },
116
- "w2k3r2": {
117
- "roles": [
118
- "agent"
119
- ],
120
- "platform": "windows-2003r2-x86_64",
121
- "hypervisor": "fusion",
122
- "snapshot": "clean-w-keys"
123
- }
124
- },
125
- "nfs_server": "none",
126
- "pe_ver": "3.2.2-6-gd1cae98",
127
- "home": "/Users/anode",
128
- "answers": {
129
- "q_puppet_enterpriseconsole_auth_user_email": "admin@example.com",
130
- "q_puppet_enterpriseconsole_auth_password": "~!@#$%^*-/ aZ",
131
- "q_puppet_enterpriseconsole_smtp_host": null,
132
- "q_puppet_enterpriseconsole_smtp_port": 25,
133
- "q_puppet_enterpriseconsole_smtp_username": null,
134
- "q_puppet_enterpriseconsole_smtp_password": null,
135
- "q_puppet_enterpriseconsole_smtp_use_tls": "n",
136
- "q_verify_packages": "y",
137
- "q_puppetdb_password": "~!@#$%^*-/ aZ"
138
- },
139
- "helper": [],
140
- "load_path": [],
141
- "pre_suite": [],
142
- "post_suite": [],
143
- "install": [],
144
- "modules": [],
145
- "logger": "#<Beaker::Logger:0x007f925a6b4218>"
146
- }
147
- Hypervisor for pe-centos6 is none
148
- Hypervisor for w2k8r2 is none
149
- Hypervisor for w2k3r2 is none
150
- Beaker::Hypervisor, found some none boxes to create
151
-
152
- pe-centos6 10:55:27$ which curl
153
- /usr/bin/curl
154
-
155
- pe-centos6 executed in 0.14 seconds
156
-
157
- pe-centos6 10:55:27$ which ntpdate
158
- /usr/sbin/ntpdate
159
-
160
- pe-centos6 executed in 0.01 seconds
161
-
162
- w2k8r2 10:55:27$ which curl
163
- /bin/curl
164
-
165
- w2k8r2 executed in 0.42 seconds
166
-
167
- w2k3r2 10:55:27$ which curl
168
- /bin/curl
169
-
170
- w2k3r2 executed in 0.29 seconds
171
- No tests to run for suite 'pre_suite'
172
- Begin tests/trypry.rb
173
-
174
- pe-centos6 10:55:28$ echo hello
175
- hello
176
-
177
- pe-centos6 executed in 0.01 seconds
178
-
179
- pe-centos6 10:55:28$ echo test block
180
- test block
181
-
182
- pe-centos6 executed in 0.01 seconds
183
- block result.stdout: test block
184
- block result.raw_stdout: test block
185
-
186
- pe-centos6 10:55:28$ echo test block, built in functions
187
- test block, built in functions
188
-
189
- pe-centos6 executed in 0.00 seconds
190
- built in function stdout: test block, built in functions
191
- built in function stderr:
192
-
193
- pe-centos6 10:55:28$ echo no block
194
- no block
195
-
196
- pe-centos6 executed in 0.00 seconds
197
- return var result.stdout: no block
198
- return var result.raw_stdout: no block
199
-
200
- From: /Users/anode/beaker/tests/trypry.rb @ line 19 self.run_test:
201
-
202
- 14:
203
- 15: result = on(h, "echo no block")
204
- 16: puts "return var result.stdout: #{result.stdout}"
205
- 17: puts "return var result.raw_stdout: #{result.raw_stdout}"
206
- 18:
207
- => 19: binding.pry
208
- 20:
209
- 21: end
210
-
211
- [1] pry(#<Beaker::TestCase>)>
212
- ```
213
- ### Using the console
214
- At this point I have access to the console. I have full access to Beaker hosts, the Beaker DSL and Ruby.
215
-
216
- Here's some sample console calls:
217
- ```
218
- [1] pry(#<Beaker::TestCase>)> hosts
219
- => [pe-centos6, w2k8r2, w2k3r2]
220
- [2] pry(#<Beaker::TestCase>)> on hosts[1], 'echo hello'
221
-
222
- w2k8r2 10:54:11$ echo hello
223
- hello
224
-
225
- w2k8r2 executed in 0.07 seconds
226
- => #<Beaker::Result:0x007f9f6b7a3408
227
- @cmd=" echo hello ",
228
- @exit_code=0,
229
- @host="w2k8r2",
230
- @output="hello\n",
231
- @raw_output="hello\n",
232
- @raw_stderr="",
233
- @raw_stdout="hello\n",
234
- @stderr="",
235
- @stdout="hello\n">
236
- [3] pry(#<Beaker::TestCase>)> on hosts[1], 'ls /cygdrive/c/Documents\ and\ Settings/All\ Users/Application\ Data/'
237
-
238
- w2k8r2 10:56:15$ ls /cygdrive/c/Documents\ and\ Settings/All\ Users/Application\ Data/
239
- Application Data
240
- Desktop
241
- Documents
242
- Favorites
243
- Microsoft
244
- Package Cache
245
- Start Menu
246
- Templates
247
- VMware
248
- beaker.gemspec
249
- ntuser.pol
250
-
251
- w2k8r2 executed in 0.09 seconds
252
- => #<Beaker::Result:0x007f925b227898
253
- @cmd=
254
- " ls /cygdrive/c/Documents\\ and\\ Settings/All\\ Users/Application\\ Data/ ",
255
- @exit_code=0,
256
- @host="w2k8r2",
257
- @output=
258
- "Application Data\nDesktop\nDocuments\nFavorites\nMicrosoft\nPackage Cache\nStart Menu\nTemplates\nVMware\nbeaker.gemspec\nntuser.pol\n",
259
- @raw_output=
260
- "Application Data\nDesktop\nDocuments\nFavorites\nMicrosoft\nPackage Cache\nStart Menu\nTemplates\nVMware\nbeaker.gemspec\nntuser.pol\n",
261
- @raw_stderr="",
262
- @raw_stdout=
263
- "Application Data\nDesktop\nDocuments\nFavorites\nMicrosoft\nPackage Cache\nStart Menu\nTemplates\nVMware\nbeaker.gemspec\nntuser.pol\n",
264
- @stderr="",
265
- @stdout=
266
- "Application Data\nDesktop\nDocuments\nFavorites\nMicrosoft\nPackage Cache\nStart Menu\nTemplates\nVMware\nbeaker.gemspec\nntuser.pol\n">
267
- [4] pry(#<Beaker::TestCase>)> result = on hosts[1], 'ls /cygdrive/c/Documents\ and\ Settings/All\ Users/Application\ Data/'
268
-
269
- w2k8r2 10:56:34$ ls /cygdrive/c/Documents\ and\ Settings/All\ Users/Application\ Data/
270
- Application Data
271
- Desktop
272
- Documents
273
- Favorites
274
- Microsoft
275
- Package Cache
276
- Start Menu
277
- Templates
278
- VMware
279
- beaker.gemspec
280
- ntuser.pol
281
-
282
- w2k8r2 executed in 0.08 seconds
283
- => #<Beaker::Result:0x007f925a387018
284
- @cmd=
285
- " ls /cygdrive/c/Documents\\ and\\ Settings/All\\ Users/Application\\ Data/ ",
286
- @exit_code=0,
287
- @host="w2k8r2",
288
- @output=
289
- "Application Data\nDesktop\nDocuments\nFavorites\nMicrosoft\nPackage Cache\nStart Menu\nTemplates\nVMware\nbeaker.gemspec\nntuser.pol\n",
290
- @raw_output=
291
- "Application Data\nDesktop\nDocuments\nFavorites\nMicrosoft\nPackage Cache\nStart Menu\nTemplates\nVMware\nbeaker.gemspec\nntuser.pol\n",
292
- @raw_stderr="",
293
- @raw_stdout=
294
- "Application Data\nDesktop\nDocuments\nFavorites\nMicrosoft\nPackage Cache\nStart Menu\nTemplates\nVMware\nbeaker.gemspec\nntuser.pol\n",
295
- @stderr="",
296
- @stdout=
297
- "Application Data\nDesktop\nDocuments\nFavorites\nMicrosoft\nPackage Cache\nStart Menu\nTemplates\nVMware\nbeaker.gemspec\nntuser.pol\n">
298
- [5] pry(#<Beaker::TestCase>)> result.stdout.chomp
299
- => "Application Data\nDesktop\nDocuments\nFavorites\nMicrosoft\nPackage Cache\nStart Menu\nTemplates\nVMware\nbeaker.gemspec\nntuser.pol"
300
- ```
301
- ### Continue regular test execution
302
- Simply `exit` the console.
303
- ```
304
- [6] pry(#<Beaker::TestCase>)> exit
305
- ```