beaker 2.44.0 → 2.45.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +8 -8
  2. data/CONTRIBUTING.md +7 -2
  3. data/HISTORY.md +200 -2
  4. data/acceptance/tests/puppet/web_helpers_test.rb +55 -0
  5. data/docs/Beaker-Libraries.md +2 -0
  6. data/docs/How-To-Beaker.md +0 -1
  7. data/docs/README.md +1 -1
  8. data/docs/how_to/change_terminal_output_coloring.md +32 -0
  9. data/docs/hypervisors/README.md +1 -1
  10. data/docs/hypervisors/openstack.md +80 -4
  11. data/docs/hypervisors/vagrant.md +40 -2
  12. data/docs/runner/test_run.md +31 -0
  13. data/lib/beaker/cli.rb +3 -3
  14. data/lib/beaker/dsl/helpers/web_helpers.rb +13 -4
  15. data/lib/beaker/dsl/install_utils/foss_utils.rb +1 -1
  16. data/lib/beaker/dsl/install_utils/windows_utils.rb +3 -3
  17. data/lib/beaker/host.rb +21 -1
  18. data/lib/beaker/host/unix/pkg.rb +1 -1
  19. data/lib/beaker/hypervisor/openstack.rb +1 -1
  20. data/lib/beaker/hypervisor/vagrant.rb +15 -1
  21. data/lib/beaker/options/hosts_file_parser.rb +54 -14
  22. data/lib/beaker/options/parser.rb +37 -3
  23. data/lib/beaker/options/presets.rb +2 -2
  24. data/lib/beaker/version.rb +1 -1
  25. data/spec/beaker/cli_spec.rb +4 -1
  26. data/spec/beaker/dsl/install_utils/foss_utils_spec.rb +37 -60
  27. data/spec/beaker/dsl/install_utils/windows_utils_spec.rb +3 -3
  28. data/spec/beaker/host/unix/pkg_spec.rb +20 -0
  29. data/spec/beaker/host_prebuilt_steps_spec.rb +7 -7
  30. data/spec/beaker/host_spec.rb +44 -0
  31. data/spec/beaker/hypervisor/openstack_spec.rb +66 -0
  32. data/spec/beaker/hypervisor/vagrant_spec.rb +99 -0
  33. data/spec/beaker/options/hosts_file_parser_spec.rb +95 -22
  34. data/spec/beaker/options/parser_spec.rb +93 -1
  35. data/spec/helpers.rb +10 -2
  36. metadata +6 -3
  37. data/docs/Overview.md +0 -31
@@ -153,7 +153,7 @@ module Beaker
153
153
  parser.instance_variable_set(:@command_line_parser, command_line_parser_obj)
154
154
 
155
155
  allow(OptionsFileParser).to receive(:parse_options_file).and_return(opt_file)
156
- allow(HostsFileParser).to receive(:parse_hosts_file).and_return(host_file)
156
+ allow(parser).to receive(:parse_hosts_options).and_return(host_file)
157
157
  end
158
158
 
159
159
  it 'presets have the lowest priority' do
@@ -221,6 +221,98 @@ module Beaker
221
221
 
222
222
  end
223
223
 
224
+ describe '#parse_hosts_options' do
225
+
226
+ context 'Hosts file exists' do
227
+ before :each do
228
+ allow(File).to receive(:exists?).and_return(true)
229
+ end
230
+
231
+ it 'returns the parser\'s output' do
232
+ parser.instance_variable_set( :@options, {} )
233
+ test_value = 'blaqwetjijl,emikfuj1235'
234
+ allow( Beaker::Options::HostsFileParser ).to receive(
235
+ :parse_hosts_file
236
+ ).and_return( test_value )
237
+ val1, _ = parser.parse_hosts_options
238
+ expect( val1 ).to be === test_value
239
+ end
240
+ end
241
+
242
+ context 'Hosts file does not exist' do
243
+ require 'beaker-hostgenerator'
244
+ before :each do
245
+ allow(File).to receive(:exists?).and_return(false)
246
+ end
247
+
248
+ it 'calls beaker-hostgenerator to get hosts information' do
249
+ parser.instance_variable_set( :@options, {} )
250
+ allow( Beaker::Options::HostsFileParser ).to receive(
251
+ :parse_hosts_file
252
+ ).and_raise( Errno::ENOENT )
253
+
254
+ mock_beaker_hostgenerator_cli = Object.new
255
+ cli_execute_return = 'job150865'
256
+ expect( mock_beaker_hostgenerator_cli ).to receive(
257
+ :execute
258
+ ).and_return( cli_execute_return )
259
+ expect( BeakerHostGenerator::CLI ).to receive(
260
+ :new
261
+ ).and_return( mock_beaker_hostgenerator_cli )
262
+ allow( Beaker::Options::HostsFileParser ).to receive(
263
+ :parse_hosts_string
264
+ ).with( cli_execute_return )
265
+ parser.parse_hosts_options
266
+ end
267
+
268
+ it 'sets the :hosts_file_generated flag to signal others when needed' do
269
+ options_test = {}
270
+ parser.instance_variable_set( :@options, options_test )
271
+ allow( Beaker::Options::HostsFileParser ).to receive(
272
+ :parse_hosts_file
273
+ ).and_raise( Errno::ENOENT )
274
+
275
+ mock_beaker_hostgenerator_cli = Object.new
276
+ allow( mock_beaker_hostgenerator_cli ).to receive( :execute )
277
+ allow( BeakerHostGenerator::CLI ).to receive(
278
+ :new
279
+ ).and_return( mock_beaker_hostgenerator_cli )
280
+ allow( Beaker::Options::HostsFileParser ).to receive( :parse_hosts_string )
281
+ parser.parse_hosts_options
282
+
283
+ expect( options_test[:hosts_file_generated] ).to be true
284
+ end
285
+
286
+ it 'beaker-hostgenerator failures trigger nice prints & a rethrow' do
287
+ options_test = {}
288
+ parser.instance_variable_set( :@options, options_test )
289
+ allow( Beaker::Options::HostsFileParser ).to receive(
290
+ :parse_hosts_file
291
+ ).and_raise( Errno::ENOENT )
292
+
293
+ mock_beaker_hostgenerator_cli = Object.new
294
+ expect( BeakerHostGenerator::CLI ).to receive(
295
+ :new
296
+ ).and_return( mock_beaker_hostgenerator_cli )
297
+ expect( mock_beaker_hostgenerator_cli ).to receive(
298
+ :execute
299
+ ).and_raise( BeakerHostGenerator::Exceptions::InvalidNodeSpecError )
300
+ expect( Beaker::Options::HostsFileParser ).not_to receive( :parse_hosts_string )
301
+ expect( $stdout ).to receive( :puts ).with(
302
+ /does not exist/
303
+ ).ordered
304
+ expect( $stderr ).to receive( :puts ).with(
305
+ /Exiting with an Error/
306
+ ).ordered
307
+
308
+ expect {
309
+ parser.parse_hosts_options
310
+ }.to raise_error( BeakerHostGenerator::Exceptions::InvalidNodeSpecError )
311
+ end
312
+ end
313
+
314
+ end
315
+
224
316
  context "set_default_host!" do
225
317
 
226
318
  let(:roles) { @roles || [["master", "agent", "database"], ["agent"]] }
@@ -26,7 +26,6 @@ end
26
26
 
27
27
  module HostHelpers
28
28
  HOST_DEFAULTS = { :platform => 'unix',
29
- :snapshot => 'pe',
30
29
  :roles => ['agent'],
31
30
  :snapshot => 'snap',
32
31
  :ip => 'default.ip.address',
@@ -34,6 +33,9 @@ module HostHelpers
34
33
  :dns_name => 'default.box.tld',
35
34
  :box => 'default_box_name',
36
35
  :box_url => 'http://default.box.url',
36
+ :image => 'default_image',
37
+ :flavor => 'm1.large',
38
+ :user_data => '#cloud-config\nmanage_etc_hosts: true\nfinal_message: "The host is finally up!"'
37
39
  }
38
40
 
39
41
  HOST_NAME = "vm%d"
@@ -61,7 +63,13 @@ module HostHelpers
61
63
  :gce_project => 'beaker-compute',
62
64
  :gce_keyfile => '/path/to/keyfile.p12',
63
65
  :gce_password => 'notasecret',
64
- :gce_email => '12345678910@developer.gserviceaccount.com' } )
66
+ :gce_email => '12345678910@developer.gserviceaccount.com',
67
+ :openstack_api_key => "P1as$w0rd",
68
+ :openstack_username => "user",
69
+ :openstack_auth_url => "http://openstack_hypervisor.labs.net:5000/v2.0/tokens",
70
+ :openstack_tenant => "testing",
71
+ :openstack_network => "testing",
72
+ :openstack_keyname => "nopass" } )
65
73
  end
66
74
 
67
75
  def generate_result (name, opts )
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.44.0
4
+ version: 2.45.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppetlabs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-09 00:00:00.000000000 Z
11
+ date: 2016-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -573,6 +573,7 @@ files:
573
573
  - acceptance/tests/load_path_bootstrap.rb
574
574
  - acceptance/tests/puppet/README.md
575
575
  - acceptance/tests/puppet/install_smoke_test.rb
576
+ - acceptance/tests/puppet/web_helpers_test.rb
576
577
  - acceptance/tests/puppet/with_puppet_running_on.rb
577
578
  - beaker.gemspec
578
579
  - bin/beaker
@@ -588,7 +589,6 @@ files:
588
589
  - docs/How-To-Use-User-Password-Authentication-with-Beaker.md
589
590
  - docs/How-to-Write-a-Beaker-Test-for-a-Module.md
590
591
  - docs/Lets-Write-a-Test.md
591
- - docs/Overview.md
592
592
  - docs/README.md
593
593
  - docs/Roles-What-Are-They.md
594
594
  - docs/Shared-Options-for-Executing-Beaker-Commands.md
@@ -601,6 +601,7 @@ files:
601
601
  - docs/hosts/README.md
602
602
  - docs/hosts/cisco.md
603
603
  - docs/hosts/eos.md
604
+ - docs/how_to/change_terminal_output_coloring.md
604
605
  - docs/hypervisors/README.md
605
606
  - docs/hypervisors/aws.md
606
607
  - docs/hypervisors/docker.md
@@ -614,6 +615,7 @@ files:
614
615
  - docs/hypervisors/vsphere.md
615
616
  - docs/meta/README.md
616
617
  - docs/meta/ticket_process.md
618
+ - docs/runner/test_run.md
617
619
  - docs/runner/test_suites.md
618
620
  - ext/completion/beaker-completion.bash
619
621
  - lib/beaker.rb
@@ -774,6 +776,7 @@ files:
774
776
  - spec/beaker/hypervisor/fusion_spec.rb
775
777
  - spec/beaker/hypervisor/hypervisor_spec.rb
776
778
  - spec/beaker/hypervisor/hypervisor_spec.rb.orig
779
+ - spec/beaker/hypervisor/openstack_spec.rb
777
780
  - spec/beaker/hypervisor/solaris_spec.rb
778
781
  - spec/beaker/hypervisor/vagrant_fusion_spec.rb
779
782
  - spec/beaker/hypervisor/vagrant_libvirt_spec.rb
@@ -1,31 +0,0 @@
1
- Beaker is an acceptance testing harness for Puppet PE and other Puppet Projects. It can also be used as a virtual machine provisioner - setting up machines, running any configuration on those machines and then exiting.
2
-
3
- Beaker goes through several phases when running tests
4
-
5
- * Provisioning
6
- * skip with `--no-provision`
7
- * Using supported hypervisors provision SUTs for testing on
8
- * Do any initial configuration to ensure that the SUTs can communicate with beaker and each other
9
- * Validation
10
- * skip with `--no-validate`
11
- * Check the SUTs for necessary packages (curl, ntpdate)
12
- * Configuration
13
- * skip with `--no-configure`
14
- * Do any post-provisioning configuration to the test nodes
15
- * Testing
16
- * Pre-Suite
17
- * use `--pre-suite`
18
- * Run any test files defined as part of the `--pre-suite` command line option
19
- * Tests
20
- * use `--tests`
21
- * Run any test files defined as part of the `--tests` command line option
22
- * Post-Suite
23
- * use `--post-suite`
24
- * Run any test files defined as part of the `--post-suite` command line option
25
- * Reverting
26
- * Skip with `--preserve-hosts`
27
- * Destroy and cleanup all SUTs
28
- * Cleanup
29
- * Report test results
30
-
31
- Beaker runs tests written in Ruby with an additional DSL API. This gives you access to all standard Ruby along with acceptance testing specific commands.