beaker 3.20.0 → 3.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +8 -8
  2. data/beaker.gemspec +4 -5
  3. data/docs/how_to/hypervisors/README.md +7 -3
  4. data/docs/tutorials/quick_start_rake_tasks.md +1 -1
  5. data/lib/beaker/command.rb +1 -1
  6. data/lib/beaker/host.rb +6 -4
  7. data/lib/beaker/host/windows/exec.rb +10 -0
  8. data/lib/beaker/host/windows/pkg.rb +1 -29
  9. data/lib/beaker/host_prebuilt_steps.rb +1 -0
  10. data/lib/beaker/hypervisor.rb +26 -37
  11. data/lib/beaker/ssh_connection.rb +8 -15
  12. data/lib/beaker/version.rb +1 -1
  13. data/spec/beaker/dsl/install_utils/windows_utils_spec.rb +1 -1
  14. data/spec/beaker/host/windows/exec_spec.rb +18 -0
  15. data/spec/beaker/host/windows/pkg_spec.rb +0 -7
  16. data/spec/beaker/host_prebuilt_steps_spec.rb +1 -0
  17. data/spec/beaker/host_spec.rb +31 -40
  18. data/spec/beaker/hypervisor/hypervisor_spec.rb +20 -34
  19. data/spec/beaker/ssh_connection_spec.rb +18 -19
  20. data/spec/spec_helper.rb +0 -1
  21. metadata +23 -57
  22. data/docs/how_to/hypervisors/aws.md +0 -149
  23. data/docs/how_to/hypervisors/ec2.md +0 -81
  24. data/docs/how_to/hypervisors/google_compute_engine.md +0 -41
  25. data/docs/how_to/hypervisors/vagrant.md +0 -165
  26. data/docs/how_to/hypervisors/vagrant_hosts_file_examples.md +0 -60
  27. data/docs/how_to/hypervisors/vagrant_libvirt.md +0 -58
  28. data/docs/how_to/hypervisors/vmware_fusion.md +0 -36
  29. data/docs/how_to/hypervisors/vsphere.md +0 -54
  30. data/lib/beaker/hypervisor/aws_sdk.rb +0 -989
  31. data/lib/beaker/hypervisor/ec2_helper.rb +0 -41
  32. data/lib/beaker/hypervisor/fusion.rb +0 -65
  33. data/lib/beaker/hypervisor/google_compute.rb +0 -164
  34. data/lib/beaker/hypervisor/google_compute_helper.rb +0 -577
  35. data/lib/beaker/hypervisor/vagrant.rb +0 -286
  36. data/lib/beaker/hypervisor/vagrant_custom.rb +0 -11
  37. data/lib/beaker/hypervisor/vagrant_fusion.rb +0 -17
  38. data/lib/beaker/hypervisor/vagrant_libvirt.rb +0 -41
  39. data/lib/beaker/hypervisor/vagrant_parallels.rb +0 -18
  40. data/lib/beaker/hypervisor/vagrant_virtualbox.rb +0 -76
  41. data/lib/beaker/hypervisor/vagrant_workstation.rb +0 -13
  42. data/lib/beaker/hypervisor/vsphere.rb +0 -85
  43. data/lib/beaker/hypervisor/vsphere_helper.rb +0 -204
  44. data/spec/beaker/hypervisor/aws_sdk_spec.rb +0 -980
  45. data/spec/beaker/hypervisor/ec2_helper_spec.rb +0 -44
  46. data/spec/beaker/hypervisor/fusion_spec.rb +0 -41
  47. data/spec/beaker/hypervisor/vagrant_custom_spec.rb +0 -46
  48. data/spec/beaker/hypervisor/vagrant_fusion_spec.rb +0 -32
  49. data/spec/beaker/hypervisor/vagrant_libvirt_spec.rb +0 -61
  50. data/spec/beaker/hypervisor/vagrant_parallels_spec.rb +0 -44
  51. data/spec/beaker/hypervisor/vagrant_spec.rb +0 -479
  52. data/spec/beaker/hypervisor/vagrant_virtualbox_spec.rb +0 -44
  53. data/spec/beaker/hypervisor/vagrant_workstation_spec.rb +0 -32
  54. data/spec/beaker/hypervisor/vsphere_helper_spec.rb +0 -163
  55. data/spec/beaker/hypervisor/vsphere_spec.rb +0 -90
@@ -2,50 +2,36 @@ require 'spec_helper'
2
2
 
3
3
  module Beaker
4
4
  describe Hypervisor do
5
- let( :hypervisor ) { Beaker::Hypervisor }
5
+ let( :hosts ) { make_hosts( { :platform => 'el-5' } ) }
6
6
 
7
- it "includes custom hypervisor" do
8
- expect{ hypervisor.create('custom_hypervisor', [], make_opts() )}.to raise_error(RuntimeError, "Invalid hypervisor: custom_hypervisor")
9
- end
7
+ context "#create" do
8
+ let( :hypervisor ) { Beaker::Hypervisor }
10
9
 
11
- it "creates a vsphere hypervisor for vsphere hosts" do
12
- vsphere = double( 'vsphere' )
13
- allow( vsphere ).to receive( :provision ).and_return( true )
14
- expect( Vsphere ).to receive( :new ).once.and_return( vsphere )
15
- expect( hypervisor.create( 'vsphere', [], make_opts() ) ).to be === vsphere
16
- end
10
+ it "includes custom hypervisor and call set_ssh_connection_preference" do
11
+ allow(hypervisor).to receive(:set_ssh_connection_preference).with([], hypervisor)
12
+ expect{ hypervisor.create('custom_hypervisor', [], make_opts() )}.to raise_error(RuntimeError, "Invalid hypervisor: custom_hypervisor")
13
+ end
17
14
 
18
- it "creates a fusion hypervisor for fusion hosts" do
19
- fusion = double( 'fusion' )
20
- allow( fusion ).to receive( :provision ).and_return( true )
21
- expect( Fusion ).to receive( :new ).once.and_return( fusion )
22
- expect( hypervisor.create( 'fusion', [], make_opts() ) ).to be === fusion
23
- end
15
+ it "sets ssh connection preference if connection_preference method is not overwritten" do
16
+ hypervisor.create('none', hosts, make_opts())
17
+ expect(hosts[0][:ssh_connection_preference]).to eq(['ip', 'vmhostname', 'hostname'])
18
+ end
24
19
 
25
- it "creates a vagrant hypervisor for vagrant hosts" do
26
- vagrant = double( 'vagrant' )
27
- allow( vagrant ).to receive( :provision ).and_return( true )
28
- expect( Vagrant ).to receive( :new ).once.and_return( vagrant )
29
- expect( hypervisor.create( 'vagrant', [], make_opts() ) ).to be === vagrant
30
- end
20
+ it "tests ssh connection methods array for valid elements" do
21
+ allow(hypervisor).to receive(:connection_preference).and_return(['my', 'invalid', 'method_name'])
22
+ expect{ hypervisor.set_ssh_connection_preference(hosts, hypervisor)}.to raise_error(ArgumentError, /overriding/)
23
+ end
31
24
 
32
- it "creates a vagrant_fusion hypervisor for vagrant vmware fusion hosts" do
33
- vagrant = double( 'vagrant_fusion' )
34
- allow( vagrant ).to receive( :provision ).and_return( true )
35
- expect( VagrantFusion ).to receive( :new ).once.and_return( vagrant )
36
- expect( hypervisor.create( 'vagrant_fusion', [], make_opts() ) ).to be === vagrant
37
- end
25
+ it "sets to new preference if connection_preference is overridden" do
26
+ allow(hypervisor).to receive(:connection_preference).and_return(['vmhostname', 'hostname', 'ip'])
27
+ hypervisor.set_ssh_connection_preference(hosts, hypervisor)
28
+ expect(hosts[0][:ssh_connection_preference]).to eq(['vmhostname', 'hostname', 'ip'])
29
+ end
38
30
 
39
- it "creates a vagrant_virtualbox hypervisor for vagrant virtualbox hosts" do
40
- vagrant = double( 'vagrant_virtualbox' )
41
- allow( vagrant ).to receive( :provision ).and_return( true )
42
- expect( VagrantVirtualbox ).to receive( :new ).once.and_return( vagrant )
43
- expect( hypervisor.create( 'vagrant_virtualbox', [], make_opts() ) ).to be === vagrant
44
31
  end
45
32
 
46
33
  context "#configure" do
47
34
  let( :options ) { make_opts.merge({ 'logger' => double().as_null_object }) }
48
- let( :hosts ) { make_hosts( { :platform => 'el-5' } ) }
49
35
  let( :hypervisor ) { Beaker::Hypervisor.new( hosts, options ) }
50
36
 
51
37
  context 'if :timesync option set true on host' do
@@ -5,7 +5,7 @@ module Beaker
5
5
  describe SshConnection do
6
6
  let( :user ) { 'root' }
7
7
  let( :ssh_opts ) { { keepalive: true, keepalive_interval: 2 } }
8
- let( :options ) { { :logger => double('logger').as_null_object } }
8
+ let( :options ) { { :logger => double('logger').as_null_object, :ssh_connection_preference => ["ip", "vmhostname", "hostname"]} }
9
9
  let( :ip ) { "default.ip.address" }
10
10
  let( :vmhostname ){ "vmhostname" }
11
11
  let( :hostname) { "my_host" }
@@ -18,25 +18,24 @@ module Beaker
18
18
 
19
19
  it 'self.connect creates connects and returns a proxy for that connection' do
20
20
  # grrr
21
- expect( Net::SSH ).to receive(:start).with( vmhostname, user, ssh_opts ).and_return(true)
21
+ expect( Net::SSH ).to receive(:start).with( ip, user, ssh_opts ).and_return(true)
22
22
  connection_constructor = SshConnection.connect name_hash, user, ssh_opts, options
23
23
  expect( connection_constructor ).to be_a_kind_of SshConnection
24
24
  end
25
25
 
26
26
  it 'connect creates a new connection' do
27
- expect( Net::SSH ).to receive( :start ).with( vmhostname, user, ssh_opts).and_return(true)
27
+ expect( Net::SSH ).to receive( :start ).with( ip, user, ssh_opts).and_return(true)
28
28
  connection.connect
29
29
  end
30
30
 
31
31
  it 'connect caches its connection' do
32
- expect( Net::SSH ).to receive( :start ).with( vmhostname, user, ssh_opts ).once.and_return true
33
- connection.connect
32
+ expect( Net::SSH ).to receive( :start ).with( ip, user, ssh_opts ).once.and_return true
34
33
  connection.connect
35
34
  end
36
35
 
37
- it 'attempts to connect by ip address if vmhostname connection fails' do
38
- expect( Net::SSH ).to receive( :start ).with( vmhostname, user, ssh_opts).and_return(false)
39
- expect( Net::SSH ).to receive( :start ).with( ip, user, ssh_opts).and_return(true).once
36
+ it 'attempts to connect by vmhostname address if ip connection fails' do
37
+ expect( Net::SSH ).to receive( :start ).with( ip, user, ssh_opts).and_return(false)
38
+ expect( Net::SSH ).to receive( :start ).with( vmhostname, user, ssh_opts).and_return(true).once
40
39
  expect( Net::SSH ).to receive( :start ).with( hostname, user, ssh_opts).never
41
40
  connection.connect
42
41
  end
@@ -53,7 +52,7 @@ module Beaker
53
52
 
54
53
  it 'runs ssh close' do
55
54
  mock_ssh = Object.new
56
- expect( Net::SSH ).to receive( :start ).with( vmhostname, user, ssh_opts) { mock_ssh }
55
+ expect( Net::SSH ).to receive( :start ).with( ip, user, ssh_opts) { mock_ssh }
57
56
  connection.connect
58
57
 
59
58
  allow( mock_ssh).to receive( :closed? ).once.and_return(false)
@@ -63,7 +62,7 @@ module Beaker
63
62
 
64
63
  it 'sets the @ssh variable to nil' do
65
64
  mock_ssh = Object.new
66
- expect( Net::SSH ).to receive( :start ).with( vmhostname, user, ssh_opts) { mock_ssh }
65
+ expect( Net::SSH ).to receive( :start ).with( ip, user, ssh_opts) { mock_ssh }
67
66
  connection.connect
68
67
 
69
68
  allow( mock_ssh).to receive( :closed? ).once.and_return(false)
@@ -76,7 +75,7 @@ module Beaker
76
75
  it 'calls ssh shutdown & re-raises if ssh close fails with an unexpected Error' do
77
76
  mock_ssh = Object.new
78
77
  allow( mock_ssh ).to receive( :close ) { raise StandardError }
79
- expect( Net::SSH ).to receive( :start ).with( vmhostname, user, ssh_opts) { mock_ssh }
78
+ expect( Net::SSH ).to receive( :start ).with( ip, user, ssh_opts) { mock_ssh }
80
79
  connection.connect
81
80
 
82
81
  allow( mock_ssh).to receive( :closed? ).once.and_return(false)
@@ -90,7 +89,7 @@ module Beaker
90
89
  describe '#execute' do
91
90
  it 'retries if failed with a retryable exception' do
92
91
  mock_ssh = Object.new
93
- expect( Net::SSH ).to receive( :start ).with( vmhostname, user, ssh_opts) { mock_ssh }
92
+ expect( Net::SSH ).to receive( :start ).with( ip, user, ssh_opts) { mock_ssh }
94
93
  connection.connect
95
94
 
96
95
  allow( subject ).to receive( :close )
@@ -102,7 +101,7 @@ module Beaker
102
101
 
103
102
  it 'raises an error if it fails both times' do
104
103
  mock_ssh = Object.new
105
- expect( Net::SSH ).to receive( :start ).with( vmhostname, user, ssh_opts) { mock_ssh }
104
+ expect( Net::SSH ).to receive( :start ).with( ip, user, ssh_opts) { mock_ssh }
106
105
  connection.connect
107
106
 
108
107
  allow( subject ).to receive( :close )
@@ -115,7 +114,7 @@ module Beaker
115
114
  describe '#request_terminal_for' do
116
115
  it 'fails correctly by raising Net::SSH::Exception' do
117
116
  mock_ssh = Object.new
118
- expect( Net::SSH ).to receive( :start ).with( vmhostname, user, ssh_opts) { mock_ssh }
117
+ expect( Net::SSH ).to receive( :start ).with( ip, user, ssh_opts) { mock_ssh }
119
118
  connection.connect
120
119
 
121
120
  mock_channel = Object.new
@@ -128,7 +127,7 @@ module Beaker
128
127
  describe '#register_stdout_for' do
129
128
  before :each do
130
129
  @mock_ssh = Object.new
131
- expect( Net::SSH ).to receive( :start ).with( vmhostname, user, ssh_opts) { @mock_ssh }
130
+ expect( Net::SSH ).to receive( :start ).with( ip, user, ssh_opts) { @mock_ssh }
132
131
  connection.connect
133
132
 
134
133
  @data = '7 of clubs'
@@ -164,7 +163,7 @@ module Beaker
164
163
 
165
164
  before :each do
166
165
  @mock_ssh = Object.new
167
- expect( Net::SSH ).to receive( :start ).with( vmhostname, user, ssh_opts) { @mock_ssh }
166
+ expect( Net::SSH ).to receive( :start ).with( ip, user, ssh_opts) { @mock_ssh }
168
167
  connection.connect
169
168
 
170
169
  @data = '3 of spades'
@@ -203,7 +202,7 @@ module Beaker
203
202
 
204
203
  it 'assigns the output\'s exit code correctly from the data' do
205
204
  mock_ssh = Object.new
206
- expect( Net::SSH ).to receive( :start ).with( vmhostname, user, ssh_opts) { mock_ssh }
205
+ expect( Net::SSH ).to receive( :start ).with( ip, user, ssh_opts) { mock_ssh }
207
206
  connection.connect
208
207
 
209
208
  data = '10 of jeromes'
@@ -236,7 +235,7 @@ module Beaker
236
235
  @mock_scp = Object.new
237
236
  allow( @mock_scp ).to receive( :upload! )
238
237
  allow( @mock_ssh ).to receive( :scp ).and_return( @mock_scp )
239
- expect( Net::SSH ).to receive( :start ).with( vmhostname, user, ssh_opts) { @mock_ssh }
238
+ expect( Net::SSH ).to receive( :start ).with( ip, user, ssh_opts) { @mock_ssh }
240
239
  connection.connect
241
240
  end
242
241
 
@@ -263,7 +262,7 @@ module Beaker
263
262
  @mock_scp = Object.new
264
263
  allow( @mock_scp ).to receive( :download! )
265
264
  allow( @mock_ssh ).to receive( :scp ).and_return( @mock_scp )
266
- expect( Net::SSH ).to receive( :start ).with( vmhostname, user, ssh_opts) { @mock_ssh }
265
+ expect( Net::SSH ).to receive( :start ).with( ip, user, ssh_opts) { @mock_ssh }
267
266
  connection.connect
268
267
  end
269
268
 
@@ -7,7 +7,6 @@ require 'matchers'
7
7
  require 'mock_fission'
8
8
  require 'mock_vsphere'
9
9
  require 'mock_vsphere_helper'
10
-
11
10
  require 'rspec/its'
12
11
 
13
12
  RSpec.configure do |config|
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: 3.20.0
4
+ version: 3.21.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-12 00:00:00.000000000 Z
11
+ date: 2017-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -305,77 +305,77 @@ dependencies:
305
305
  - !ruby/object:Gem::Version
306
306
  version: '0.0'
307
307
  - !ruby/object:Gem::Dependency
308
- name: fission
308
+ name: docker-api
309
309
  requirement: !ruby/object:Gem::Requirement
310
310
  requirements:
311
- - - ~>
311
+ - - ! '>='
312
312
  - !ruby/object:Gem::Version
313
- version: '0.4'
313
+ version: '0'
314
314
  type: :runtime
315
315
  prerelease: false
316
316
  version_requirements: !ruby/object:Gem::Requirement
317
317
  requirements:
318
- - - ~>
318
+ - - ! '>='
319
319
  - !ruby/object:Gem::Version
320
- version: '0.4'
320
+ version: '0'
321
321
  - !ruby/object:Gem::Dependency
322
- name: google-api-client
322
+ name: fog
323
323
  requirement: !ruby/object:Gem::Requirement
324
324
  requirements:
325
325
  - - ~>
326
326
  - !ruby/object:Gem::Version
327
- version: '0.9'
327
+ version: '1.38'
328
328
  type: :runtime
329
329
  prerelease: false
330
330
  version_requirements: !ruby/object:Gem::Requirement
331
331
  requirements:
332
332
  - - ~>
333
333
  - !ruby/object:Gem::Version
334
- version: '0.9'
334
+ version: '1.38'
335
335
  - !ruby/object:Gem::Dependency
336
- name: aws-sdk-v1
336
+ name: beaker-aws
337
337
  requirement: !ruby/object:Gem::Requirement
338
338
  requirements:
339
339
  - - ~>
340
340
  - !ruby/object:Gem::Version
341
- version: '1.57'
341
+ version: '0.1'
342
342
  type: :runtime
343
343
  prerelease: false
344
344
  version_requirements: !ruby/object:Gem::Requirement
345
345
  requirements:
346
346
  - - ~>
347
347
  - !ruby/object:Gem::Version
348
- version: '1.57'
348
+ version: '0.1'
349
349
  - !ruby/object:Gem::Dependency
350
- name: docker-api
350
+ name: beaker-vmpooler
351
351
  requirement: !ruby/object:Gem::Requirement
352
352
  requirements:
353
- - - ! '>='
353
+ - - ~>
354
354
  - !ruby/object:Gem::Version
355
- version: '0'
355
+ version: '0.1'
356
356
  type: :runtime
357
357
  prerelease: false
358
358
  version_requirements: !ruby/object:Gem::Requirement
359
359
  requirements:
360
- - - ! '>='
360
+ - - ~>
361
361
  - !ruby/object:Gem::Version
362
- version: '0'
362
+ version: '0.1'
363
363
  - !ruby/object:Gem::Dependency
364
- name: fog
364
+ name: beaker-google
365
365
  requirement: !ruby/object:Gem::Requirement
366
366
  requirements:
367
367
  - - ~>
368
368
  - !ruby/object:Gem::Version
369
- version: '1.38'
369
+ version: '0.1'
370
370
  type: :runtime
371
371
  prerelease: false
372
372
  version_requirements: !ruby/object:Gem::Requirement
373
373
  requirements:
374
374
  - - ~>
375
375
  - !ruby/object:Gem::Version
376
- version: '1.38'
376
+ version: '0.1'
377
377
  - !ruby/object:Gem::Dependency
378
- name: beaker-vmpooler
378
+ name: beaker-vagrant
379
379
  requirement: !ruby/object:Gem::Requirement
380
380
  requirements:
381
381
  - - ~>
@@ -389,7 +389,7 @@ dependencies:
389
389
  - !ruby/object:Gem::Version
390
390
  version: '0.1'
391
391
  - !ruby/object:Gem::Dependency
392
- name: unf
392
+ name: beaker-vmware
393
393
  requirement: !ruby/object:Gem::Requirement
394
394
  requirements:
395
395
  - - ~>
@@ -555,17 +555,9 @@ files:
555
555
  - docs/how_to/hosts/cisco.md
556
556
  - docs/how_to/hosts/eos.md
557
557
  - docs/how_to/hypervisors/README.md
558
- - docs/how_to/hypervisors/aws.md
559
558
  - docs/how_to/hypervisors/docker.md
560
- - docs/how_to/hypervisors/ec2.md
561
- - docs/how_to/hypervisors/google_compute_engine.md
562
559
  - docs/how_to/hypervisors/openstack.md
563
560
  - docs/how_to/hypervisors/solaris.md
564
- - docs/how_to/hypervisors/vagrant.md
565
- - docs/how_to/hypervisors/vagrant_hosts_file_examples.md
566
- - docs/how_to/hypervisors/vagrant_libvirt.md
567
- - docs/how_to/hypervisors/vmware_fusion.md
568
- - docs/how_to/hypervisors/vsphere.md
569
561
  - docs/how_to/install_puppet.md
570
562
  - docs/how_to/platform_specific_tag_confines.md
571
563
  - docs/how_to/preserve_hosts.md
@@ -647,23 +639,9 @@ files:
647
639
  - lib/beaker/host/windows/user.rb
648
640
  - lib/beaker/host_prebuilt_steps.rb
649
641
  - lib/beaker/hypervisor.rb
650
- - lib/beaker/hypervisor/aws_sdk.rb
651
642
  - lib/beaker/hypervisor/docker.rb
652
- - lib/beaker/hypervisor/ec2_helper.rb
653
- - lib/beaker/hypervisor/fusion.rb
654
- - lib/beaker/hypervisor/google_compute.rb
655
- - lib/beaker/hypervisor/google_compute_helper.rb
656
643
  - lib/beaker/hypervisor/noop.rb
657
644
  - lib/beaker/hypervisor/openstack.rb
658
- - lib/beaker/hypervisor/vagrant.rb
659
- - lib/beaker/hypervisor/vagrant_custom.rb
660
- - lib/beaker/hypervisor/vagrant_fusion.rb
661
- - lib/beaker/hypervisor/vagrant_libvirt.rb
662
- - lib/beaker/hypervisor/vagrant_parallels.rb
663
- - lib/beaker/hypervisor/vagrant_virtualbox.rb
664
- - lib/beaker/hypervisor/vagrant_workstation.rb
665
- - lib/beaker/hypervisor/vsphere.rb
666
- - lib/beaker/hypervisor/vsphere_helper.rb
667
645
  - lib/beaker/junit.xsl
668
646
  - lib/beaker/logger.rb
669
647
  - lib/beaker/logger_junit.rb
@@ -733,22 +711,10 @@ files:
733
711
  - spec/beaker/host/windows_spec.rb
734
712
  - spec/beaker/host_prebuilt_steps_spec.rb
735
713
  - spec/beaker/host_spec.rb
736
- - spec/beaker/hypervisor/aws_sdk_spec.rb
737
714
  - spec/beaker/hypervisor/docker_spec.rb
738
- - spec/beaker/hypervisor/ec2_helper_spec.rb
739
- - spec/beaker/hypervisor/fusion_spec.rb
740
715
  - spec/beaker/hypervisor/hypervisor_spec.rb
741
716
  - spec/beaker/hypervisor/hypervisor_spec.rb.orig
742
717
  - spec/beaker/hypervisor/openstack_spec.rb
743
- - spec/beaker/hypervisor/vagrant_custom_spec.rb
744
- - spec/beaker/hypervisor/vagrant_fusion_spec.rb
745
- - spec/beaker/hypervisor/vagrant_libvirt_spec.rb
746
- - spec/beaker/hypervisor/vagrant_parallels_spec.rb
747
- - spec/beaker/hypervisor/vagrant_spec.rb
748
- - spec/beaker/hypervisor/vagrant_virtualbox_spec.rb
749
- - spec/beaker/hypervisor/vagrant_workstation_spec.rb
750
- - spec/beaker/hypervisor/vsphere_helper_spec.rb
751
- - spec/beaker/hypervisor/vsphere_spec.rb
752
718
  - spec/beaker/logger_junit_spec.rb
753
719
  - spec/beaker/logger_spec.rb
754
720
  - spec/beaker/network_manager_spec.rb
@@ -1,149 +0,0 @@
1
- # Amazon Web Services - Elastic Compute Cloud (EC2)
2
-
3
- EC2 is a "web service that provides resizable compute capacity in the cloud."
4
-
5
- [EC2 site](https://aws.amazon.com/ec2/).
6
-
7
- # Getting Started
8
-
9
- ### Requirements
10
-
11
- - Get EC2 access from your IT dept, particularly your `aws_access_key_id` & `aws_secret_access_key`.
12
- - put these values into your [~/.fog file](http://fog.io/about/getting_started.html).
13
-
14
- ### Setup Amazon Image Config
15
-
16
- The Amazon Image Config file in Beaker is the file that specifies which Amazon
17
- Machine Image (AMI) should be used for a host and which EC2 region that host
18
- should be generated into.
19
-
20
- The text in this file follows this form:
21
-
22
- AMI:
23
- <host-vmname-value>:
24
- :image:
25
- :<type>: <ami-id>
26
- :<type>: <ami-id>
27
- :region: <region-id>
28
- <host-vmname-value>:
29
- ...
30
-
31
- The `host-vmname-value` is an ID used to reference one of these particular AMI
32
- definitions. It is applied to a host via the `vmname` key in the hosts file.
33
-
34
- The `type` variable is an arbitrary key that you can use to specify the different
35
- types of that host platform that you can be testing with. Note that this value
36
- will be grabbed automatically via the value for the host's `snapshot` key.
37
- For example, we tend to use `:pe` and `:foss` for these values.
38
-
39
- The `ami-id` variable is the AMI ID as specified by Amazon. You can see the AMI
40
- ID pattern in EC2's
41
- [Find a Linux AMI]
42
- (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/finding-an-ami.html)
43
- page, particularly in the "using the Images page" section's step 7. For some
44
- examples of AMI IDs, check out their
45
- [Amazon Linux AMI page](https://aws.amazon.com/amazon-linux-ami/).
46
-
47
- The `region-id` variable represents the EC2 region ID from AWS. For reference,
48
- checkout EC2's
49
- [Regions and Availability Zones page]
50
- (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html).
51
- An example of a region ID is `eu-west-1` for the Ireland data center.
52
-
53
- This file is by default located at `config/image_templates/ec2.yaml`. This is a
54
- relative path from Beaker's execution location, and can be overridden using the
55
- `:ec2_yaml` key in a CONFIG section of a host file if required.
56
-
57
- ### Create a Hosts File to Use
58
-
59
- An EC2 hosts file looks like a typical hosts file, except that there are a
60
- number of required properties that need to be added to every host in order for
61
- the AWS hypervisor to provision hosts properly. They come in this form:
62
-
63
- <hostname>:
64
- <usual stuff, roles, etc>
65
- vmname: <host-vmname-value>
66
- hypervisor: ec2
67
- snapshot: <type>
68
- amisize: <ami-size>
69
- platform: <platform-name>
70
-
71
- The `host-vmname-value` references the ID created in the Amazon Image Config file
72
- above. If not provided, Beaker will try to name an AMI Config using the host's
73
- platform string.
74
-
75
- **Note:** If you are using `amazon-6-x86_64` as `vmname`, you have to specify `platform` as `el-6-x86_64`. Similarly for `amazon-6-i386` use `el-6-i386` as `platform`.
76
-
77
- The `type` references the type variable in the Amazon Image Config file as well,
78
- so this key picks out the particular AMI ID from the set available for this type
79
- of host platform.
80
-
81
- The `ami-size` variable refers to
82
- [instance types](https://aws.amazon.com/ec2/instance-types/) by their model name.
83
- Some examples of these values are "m3.large", "c4.xlarge", and "r3.8xlarge". The
84
- default value if this key is not provided used by Beaker is "m1.small".
85
-
86
- ### ec2 VM Hostnames
87
-
88
- By default, beaker will set the hostnames of the VMs to the 'Public DNS' hostname supplied by ec2 (and which is normally based on the Public IP address). If your test requires the hosts be named identically to the `<hostname>:` from your beaker hosts file, set `:use_beaker_hostnames: true` in the beaker hosts file.
89
-
90
- # AWS Keys
91
-
92
- For any particular Beaker run, a new EC2 ssh key with a name of the form
93
-
94
- Beaker-<username>-<sanitized_hostname>-<aws_keyname_modifier>-<readable_timestamp>
95
-
96
- will be created at the beginning of the run, & cleaned up at the end of the run.
97
-
98
- Everything up to `aws_keyname_modifier` will be the same if run from the same
99
- user on the same machine no matter when it's run. This means that if you're
100
- running from a CI system, all of these values will usually be the same, depending
101
- on your setup.
102
-
103
- `aws_keyname_modifier` will by default be a 10 digit random number string.
104
- `readable_timestamp`'s most fine grained unit is nanoseconds. Between the two of
105
- these, every Beaker run will generate a unique ssh key name.
106
-
107
- These keys are deleted automatically as a part of the cleanup process at the end
108
- of a Beaker run.
109
-
110
- # Zombie Killing
111
-
112
- If an EC2 host stays around after a Beaker run, we refer to it as a zombie :).
113
- Normal Beaker execution should not create zombies, but a common use case that
114
- can result in zombies is using the `--preserve-hosts` options.
115
-
116
- If you would like to be sure that you're not running up your EC2 bill via any
117
- leftover preserved hosts in your EC2 system, we recommend creating a zombie
118
- killing Beaker job.
119
-
120
- To setup a zombie killing job, you'll need a Beaker test that kills all the
121
- zombies (referred to later as `kill.rb`):
122
-
123
- ec2 = AwsSdk.new( [], options )
124
- ec2.kill_zombies( 0 )
125
-
126
- Refer to the
127
- [Rubydoc for the `kill_zombies` method]
128
- (http://www.rubydoc.info/github/puppetlabs/beaker/Beaker/AwsSdk#kill_zombies-instance_method)
129
- to learn more about it's
130
- parameters. Running this should be as simple as this:
131
-
132
- # beaker --tests kill.rb
133
-
134
- Note that the second argument is tested as a regex against key names, so you
135
- could use the key pattern described above to wipeout machines that match a
136
- pattern such as "Beaker-johnsmith", and it will catch all keys for the "johnsmith"
137
- user.
138
-
139
- ### How Do I Find Out My Key Prefix?
140
-
141
- In order to find out your key pattern as used by Beaker, just kick off a Beaker
142
- run to generate an EC2 host. When you do this, you should see lines that look
143
- like so:
144
-
145
- aws-sdk: Launch instance
146
- aws-sdk: Ensure key pair exists, create if not
147
- [AWS EC2 200 0.142666 0 retries] describe_key_pairs(:filters=>[{:name=>"key-name",:values=>["Beaker-johnsmith-Johns-Ubuntu-2-local"]}])
148
-
149
- The values string in that line is what you're looking for.