beaker 1.21.0 → 2.0.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.
Files changed (103) hide show
  1. checksums.yaml +8 -8
  2. data/.gitignore +1 -0
  3. data/.rspec +1 -0
  4. data/CONTRIBUTING.md +1 -0
  5. data/HISTORY.md +17288 -2
  6. data/Rakefile +6 -2
  7. data/beaker.gemspec +15 -19
  8. data/lib/beaker.rb +2 -5
  9. data/lib/beaker/answers.rb +2 -0
  10. data/lib/beaker/answers/version34.rb +37 -1
  11. data/lib/beaker/cli.rb +4 -0
  12. data/lib/beaker/command.rb +16 -84
  13. data/lib/beaker/command_factory.rb +13 -2
  14. data/lib/beaker/dsl/assertions.rb +25 -2
  15. data/lib/beaker/dsl/ezbake_utils.rb +2 -2
  16. data/lib/beaker/dsl/helpers.rb +66 -12
  17. data/lib/beaker/dsl/install_utils.rb +128 -66
  18. data/lib/beaker/dsl/wrappers.rb +41 -3
  19. data/lib/beaker/host.rb +42 -6
  20. data/lib/beaker/host/mac.rb +62 -0
  21. data/lib/beaker/host/mac/group.rb +96 -0
  22. data/lib/beaker/host/mac/user.rb +93 -0
  23. data/lib/beaker/host/unix/exec.rb +1 -1
  24. data/lib/beaker/host/unix/pkg.rb +11 -11
  25. data/lib/beaker/host/windows.rb +4 -4
  26. data/lib/beaker/host_prebuilt_steps.rb +194 -58
  27. data/lib/beaker/hypervisor.rb +16 -9
  28. data/lib/beaker/hypervisor/aws_sdk.rb +61 -17
  29. data/lib/beaker/hypervisor/docker.rb +14 -2
  30. data/lib/beaker/hypervisor/ec2_helper.rb +15 -3
  31. data/lib/beaker/hypervisor/vagrant.rb +22 -10
  32. data/lib/beaker/hypervisor/vagrant_libvirt.rb +11 -0
  33. data/lib/beaker/hypervisor/vagrant_virtualbox.rb +1 -1
  34. data/lib/beaker/hypervisor/vcloud_pooled.rb +8 -39
  35. data/lib/beaker/logger.rb +15 -9
  36. data/lib/beaker/network_manager.rb +2 -2
  37. data/lib/beaker/options/command_line_parser.rb +1 -1
  38. data/lib/beaker/options/parser.rb +1 -8
  39. data/lib/beaker/options/presets.rb +70 -45
  40. data/lib/beaker/perf.rb +3 -4
  41. data/lib/beaker/platform.rb +2 -1
  42. data/lib/beaker/result.rb +3 -9
  43. data/lib/beaker/ssh_connection.rb +2 -0
  44. data/lib/beaker/test_case.rb +2 -21
  45. data/lib/beaker/test_suite.rb +21 -25
  46. data/lib/beaker/version.rb +1 -1
  47. data/spec/beaker/answers_spec.rb +36 -0
  48. data/spec/beaker/cli_spec.rb +45 -45
  49. data/spec/beaker/command_spec.rb +25 -36
  50. data/spec/beaker/dsl/assertions_spec.rb +20 -27
  51. data/spec/beaker/dsl/ezbake_utils_spec.rb +5 -5
  52. data/spec/beaker/dsl/helpers_spec.rb +293 -208
  53. data/spec/beaker/dsl/install_utils_spec.rb +310 -189
  54. data/spec/beaker/dsl/outcomes_spec.rb +6 -6
  55. data/spec/beaker/dsl/roles_spec.rb +27 -18
  56. data/spec/beaker/dsl/structure_spec.rb +11 -11
  57. data/spec/beaker/dsl/wrappers_spec.rb +35 -11
  58. data/spec/beaker/host/mac/group_spec.rb +124 -0
  59. data/spec/beaker/host/mac/user_spec.rb +134 -0
  60. data/spec/beaker/host/unix/pkg_spec.rb +40 -24
  61. data/spec/beaker/host/windows/group_spec.rb +1 -1
  62. data/spec/beaker/host_prebuilt_steps_spec.rb +194 -68
  63. data/spec/beaker/host_spec.rb +145 -67
  64. data/spec/beaker/hypervisor/aixer_spec.rb +6 -6
  65. data/spec/beaker/hypervisor/aws_sdk_spec.rb +22 -7
  66. data/spec/beaker/hypervisor/docker_spec.rb +71 -50
  67. data/spec/beaker/hypervisor/ec2_helper_spec.rb +25 -4
  68. data/spec/beaker/hypervisor/fusion_spec.rb +2 -2
  69. data/spec/beaker/hypervisor/hypervisor_spec.rb +20 -27
  70. data/spec/beaker/hypervisor/hypervisor_spec.rb.orig +80 -0
  71. data/spec/beaker/hypervisor/solaris_spec.rb +8 -8
  72. data/spec/beaker/hypervisor/vagrant_fusion_spec.rb +6 -8
  73. data/spec/beaker/hypervisor/vagrant_libvirt_spec.rb +34 -0
  74. data/spec/beaker/hypervisor/vagrant_spec.rb +34 -33
  75. data/spec/beaker/hypervisor/vagrant_virtualbox_spec.rb +18 -8
  76. data/spec/beaker/hypervisor/vagrant_workstation_spec.rb +6 -8
  77. data/spec/beaker/hypervisor/vcloud_pooled_spec.rb +8 -8
  78. data/spec/beaker/hypervisor/vcloud_spec.rb +10 -10
  79. data/spec/beaker/hypervisor/vsphere_helper_spec.rb +8 -8
  80. data/spec/beaker/hypervisor/vsphere_spec.rb +1 -1
  81. data/spec/beaker/logger_spec.rb +45 -31
  82. data/spec/beaker/options/command_line_parser_spec.rb +10 -2
  83. data/spec/beaker/options/hosts_file_parser_spec.rb +9 -2
  84. data/spec/beaker/options/options_hash_spec.rb +2 -2
  85. data/spec/beaker/options/parser_spec.rb +2 -2
  86. data/spec/beaker/options/pe_version_scaper_spec.rb +6 -1
  87. data/spec/beaker/options/presets_spec.rb +11 -1
  88. data/spec/beaker/shared/error_handler_spec.rb +5 -5
  89. data/spec/beaker/shared/host_manager_spec.rb +3 -2
  90. data/spec/beaker/shared/repetition_spec.rb +18 -18
  91. data/spec/beaker/ssh_connection_spec.rb +33 -4
  92. data/spec/beaker/test_case_spec.rb +9 -9
  93. data/spec/beaker/test_suite_spec.rb +14 -14
  94. data/spec/helpers.rb +4 -4
  95. data/spec/matchers.rb +4 -4
  96. data/spec/mocks.rb +5 -1
  97. data/spec/spec_helper.rb +2 -8
  98. metadata +114 -80
  99. data/lib/beaker/hypervisor/blimper.rb +0 -108
  100. data/spec/beaker/hypervisor/blimper_spec.rb +0 -42
  101. data/spec/beaker/options/data/LATEST +0 -1
  102. data/spec/beaker/puppet_command_spec.rb +0 -161
  103. data/spec/mock_blimpy.rb +0 -48
@@ -2,13 +2,14 @@ require 'spec_helper'
2
2
 
3
3
  module Beaker
4
4
  describe AwsSdk do
5
+ let( :options ) { make_opts.merge({ 'logger' => double().as_null_object }) }
5
6
  let(:aws) {
6
7
  # Mock out the call to load_fog_credentials
7
- Beaker::AwsSdk.any_instance.stub(:load_fog_credentials).and_return(fog_file_contents)
8
+ allow_any_instance_of( Beaker::AwsSdk ).to receive(:load_fog_credentials).and_return(fog_file_contents)
8
9
 
9
10
  # This is needed because the EC2 api looks up a local endpoints.json file
10
11
  FakeFS.deactivate!
11
- aws = Beaker::AwsSdk.new(@hosts, make_opts)
12
+ aws = Beaker::AwsSdk.new(@hosts, options)
12
13
  FakeFS.activate!
13
14
 
14
15
  aws
@@ -26,18 +27,32 @@ module Beaker
26
27
  :image => {:pe => "ami-sekrit3"},
27
28
  :region => "us-west-2",
28
29
  },
30
+ "ubuntu-12.04-amd64-west" => {
31
+ :image => {:pe => "ami-sekrit4"},
32
+ :region => "us-west-2"
33
+ },
29
34
  }}
30
35
 
31
36
  before :each do
32
- @hosts = make_hosts({:snapshot => :pe})
37
+ @hosts = make_hosts({:snapshot => :pe}, 4)
33
38
  @hosts[0][:platform] = "centos-5-x86-64-west"
34
39
  @hosts[1][:platform] = "centos-6-x86-64-west"
35
40
  @hosts[2][:platform] = "centos-7-x86-64-west"
41
+ @hosts[3][:platform] = "ubuntu-12.04-amd64-west"
42
+ @hosts[3][:user] = "ubuntu"
43
+ end
44
+
45
+ context 'enabling root shall be called once for the ubuntu machine' do
46
+ it "should enable root once" do
47
+ expect( aws ).to receive(:copy_ssh_to_root).with( @hosts[3], options ).once()
48
+ expect( aws ).to receive(:enable_root_login).with( @hosts[3], options).once()
49
+ aws.enable_root_on_hosts();
50
+ end
36
51
  end
37
52
 
38
53
  context '#backoff_sleep' do
39
54
  it "should call sleep 1024 times at attempt 10" do
40
- Object.any_instance.should_receive(:sleep).with(1024)
55
+ expect_any_instance_of( Object ).to receive(:sleep).with(1024)
41
56
  aws.backoff_sleep(10)
42
57
  end
43
58
  end
@@ -48,7 +63,7 @@ module Beaker
48
63
  allow(File).to receive(:exists?).with(/id_rsa.pub/) { true }
49
64
  allow(File).to receive(:read).with(/id_rsa.pub/) { "foobar" }
50
65
 
51
- # Should return contents of previously stubbed id_rsa.pub
66
+ # Should return contents of allow( previously ).to receivebed id_rsa.pub
52
67
  expect(aws.public_key).to eq("foobar")
53
68
  end
54
69
 
@@ -60,8 +75,8 @@ module Beaker
60
75
  context '#key_name' do
61
76
  it 'returns a key name from the local hostname' do
62
77
  # Mock out the hostname and local user calls
63
- Socket.should_receive(:gethostname) { "foobar" }
64
- aws.should_receive(:local_user) { "bob" }
78
+ expect( Socket ).to receive(:gethostname) { "foobar" }
79
+ expect( aws ).to receive(:local_user) { "bob" }
65
80
 
66
81
  # Should match the expected composite key name
67
82
  expect(aws.key_name).to eq("Beaker-bob-foobar")
@@ -14,27 +14,27 @@ module Beaker
14
14
 
15
15
  let(:logger) do
16
16
  logger = double('logger')
17
- logger.stub(:debug)
18
- logger.stub(:info)
19
- logger.stub(:warn)
20
- logger.stub(:error)
21
- logger.stub(:notify)
17
+ allow( logger ).to receive(:debug)
18
+ allow( logger ).to receive(:info)
19
+ allow( logger ).to receive(:warn)
20
+ allow( logger ).to receive(:error)
21
+ allow( logger ).to receive(:notify)
22
22
  logger
23
23
  end
24
24
 
25
25
  let(:image) do
26
26
  image = double('Docker::Image')
27
- image.stub(:id)
28
- image.stub(:tag)
29
- image.stub(:delete)
27
+ allow( image ).to receive(:id)
28
+ allow( image ).to receive(:tag)
29
+ allow( image ).to receive(:delete)
30
30
  image
31
31
  end
32
32
 
33
33
  let(:container) do
34
34
  container = double('Docker::Container')
35
- container.stub(:id)
36
- container.stub(:start)
37
- container.stub(:json).and_return({
35
+ allow( container ).to receive(:id)
36
+ allow( container ).to receive(:start)
37
+ allow( container ).to receive(:json).and_return({
38
38
  'NetworkSettings' => {
39
39
  'IPAddress' => '192.0.2.1',
40
40
  'Ports' => {
@@ -47,51 +47,63 @@ module Beaker
47
47
  },
48
48
  },
49
49
  })
50
- container.stub(:stop)
51
- container.stub(:delete)
50
+ allow( container ).to receive(:stop)
51
+ allow( container ).to receive(:delete)
52
52
  container
53
53
  end
54
54
 
55
55
  let (:docker) { ::Beaker::Docker.new( hosts, { :logger => logger }) }
56
+ let(:docker_options) { nil }
56
57
 
57
58
  before :each do
58
59
  # Stub out all of the docker-api gem. we should never really call it
59
60
  # from these tests
60
- ::Beaker::Docker.any_instance.stub(:require).with('docker')
61
- ::Docker.stub(:options=)
62
- ::Docker.stub(:logger=)
63
- ::Docker.stub(:validate_version!)
64
- ::Docker::Image.stub(:build).and_return(image)
65
- ::Docker::Container.stub(:create).and_return(container)
66
- ::Docker::Container.any_instance.stub(:start)
61
+ allow_any_instance_of( ::Beaker::Docker ).to receive(:require).with('docker')
62
+ allow( ::Docker ).to receive(:options).and_return(docker_options)
63
+ allow( ::Docker ).to receive(:options=)
64
+ allow( ::Docker ).to receive(:logger=)
65
+ allow( ::Docker ).to receive(:validate_version!)
66
+ allow( ::Docker::Image ).to receive(:build).and_return(image)
67
+ allow( ::Docker::Container ).to receive(:create).and_return(container)
68
+ allow_any_instance_of( ::Docker::Container ).to receive(:start)
67
69
  end
68
70
 
69
71
  describe '#initialize' do
70
72
  it 'should require the docker gem' do
71
- ::Beaker::Docker.any_instance.should_receive(:require).with('docker').once
73
+ expect_any_instance_of( ::Beaker::Docker ).to receive(:require).with('docker').once
72
74
 
73
75
  docker
74
76
  end
75
77
 
76
78
  it 'should fail when the gem is absent' do
77
- ::Beaker::Docker.any_instance.stub(:require).with('docker').and_raise(LoadError)
79
+ allow_any_instance_of( ::Beaker::Docker ).to receive(:require).with('docker').and_raise(LoadError)
78
80
  expect { docker }.to raise_error(LoadError)
79
81
  end
80
82
 
81
83
  it 'should set Docker options' do
82
- ::Docker.should_receive(:options=).once
84
+ expect( ::Docker ).to receive(:options=).with({:write_timeout => 300, :read_timeout => 300}).once
83
85
 
84
86
  docker
85
87
  end
86
88
 
89
+ context 'when Docker options are already set' do
90
+ let(:docker_options) {{:write_timeout => 600, :foo => :bar}}
91
+
92
+ it 'should not override Docker options' do
93
+ expect( ::Docker ).to receive(:options=).with({:write_timeout => 600, :read_timeout => 300, :foo => :bar}).once
94
+
95
+ docker
96
+ end
97
+ end
98
+
87
99
  it 'should check the Docker gem can work with the api' do
88
- ::Docker.should_receive(:validate_version!).once
100
+ expect( ::Docker ).to receive(:validate_version!).once
89
101
 
90
102
  docker
91
103
  end
92
104
 
93
105
  it 'should hook the Beaker logger into the Docker one' do
94
- ::Docker.should_receive(:logger=).with(logger)
106
+ expect( ::Docker ).to receive(:logger=).with(logger)
95
107
 
96
108
  docker
97
109
  end
@@ -99,27 +111,27 @@ module Beaker
99
111
 
100
112
  describe '#provision' do
101
113
  before :each do
102
- docker.stub(:dockerfile_for)
114
+ allow( docker ).to receive(:dockerfile_for)
103
115
  end
104
116
 
105
117
  it 'should call dockerfile_for with all the hosts' do
106
118
  hosts.each do |host|
107
- docker.should_receive(:dockerfile_for).with(host).and_return('')
119
+ expect( docker ).to receive(:dockerfile_for).with(host).and_return('')
108
120
  end
109
121
 
110
122
  docker.provision
111
123
  end
112
124
 
113
125
  it 'should pass the Dockerfile on to Docker::Image.create' do
114
- docker.stub(:dockerfile_for).and_return('special testing value')
115
- ::Docker::Image.should_receive(:build).with('special testing value', { :rm => true })
126
+ allow( docker ).to receive(:dockerfile_for).and_return('special testing value')
127
+ expect( ::Docker::Image ).to receive(:build).with('special testing value', { :rm => true })
116
128
 
117
129
  docker.provision
118
130
  end
119
131
 
120
132
  it 'should create a container based on the Image (identified by image.id)' do
121
133
  hosts.each do |host|
122
- ::Docker::Container.should_receive(:create).with({
134
+ expect( ::Docker::Container ).to receive(:create).with({
123
135
  'Image' => image.id,
124
136
  'Hostname' => host.name,
125
137
  })
@@ -129,7 +141,7 @@ module Beaker
129
141
  end
130
142
 
131
143
  it 'should start the container' do
132
- container.should_receive(:start).with({'PublishAllPorts' => true, 'Privileged' => true})
144
+ expect( container ).to receive(:start).with({'PublishAllPorts' => true, 'Privileged' => true})
133
145
 
134
146
  docker.provision
135
147
  end
@@ -142,67 +154,67 @@ module Beaker
142
154
  ENV['DOCKER_HOST'] = nil
143
155
  docker.provision
144
156
 
145
- hosts[0]['ip'].should == '127.0.1.1'
146
- hosts[0]['port'].should == 8022
157
+ expect( hosts[0]['ip'] ).to be === '127.0.1.1'
158
+ expect( hosts[0]['port'] ).to be === 8022
147
159
  end
148
160
 
149
161
  it 'should expose port 22 to beaker when using DOCKER_HOST' do
150
162
  ENV['DOCKER_HOST'] = "tcp://192.0.2.2:2375"
151
163
  docker.provision
152
164
 
153
- hosts[0]['ip'].should == '192.0.2.2'
154
- hosts[0]['port'].should == 8022
165
+ expect( hosts[0]['ip'] ).to be === '192.0.2.2'
166
+ expect( hosts[0]['port'] ).to be === 8022
155
167
  end
156
168
  end
157
169
 
158
170
  it 'should record the image and container for later' do
159
171
  docker.provision
160
172
 
161
- hosts[0]['docker_image'].should == image
162
- hosts[0]['docker_container'].should == container
173
+ expect( hosts[0]['docker_image'] ).to be === image
174
+ expect( hosts[0]['docker_container'] ).to be === container
163
175
  end
164
176
  end
165
177
 
166
178
  describe '#cleanup' do
167
179
  before :each do
168
180
  # get into a state where there's something to clean
169
- docker.stub(:dockerfile_for)
181
+ allow( docker ).to receive(:dockerfile_for)
170
182
  docker.provision
171
183
  end
172
184
 
173
185
  it 'should stop the containers' do
174
- docker.stub( :sleep ).and_return(true)
175
- container.should_receive(:stop)
186
+ allow( docker ).to receive( :sleep ).and_return(true)
187
+ expect( container ).to receive(:stop)
176
188
  docker.cleanup
177
189
  end
178
190
 
179
191
  it 'should delete the containers' do
180
- docker.stub( :sleep ).and_return(true)
181
- container.should_receive(:delete)
192
+ allow( docker ).to receive( :sleep ).and_return(true)
193
+ expect( container ).to receive(:delete)
182
194
  docker.cleanup
183
195
  end
184
196
 
185
197
  it 'should delete the images' do
186
- docker.stub( :sleep ).and_return(true)
187
- image.should_receive(:delete)
198
+ allow( docker ).to receive( :sleep ).and_return(true)
199
+ expect( image ).to receive(:delete)
188
200
  docker.cleanup
189
201
  end
190
202
 
191
203
  it 'should not delete the image if docker_preserve_image is set to true' do
192
- docker.stub( :sleep ).and_return(true)
204
+ allow( docker ).to receive( :sleep ).and_return(true)
193
205
  hosts.each do |host|
194
206
  host['docker_preserve_image']=true
195
207
  end
196
- image.should_not_receive(:delete)
208
+ expect( image ).to_not receive(:delete)
197
209
  docker.cleanup
198
210
  end
199
211
 
200
212
  it 'should delete the image if docker_preserve_image is set to false' do
201
- docker.stub( :sleep ).and_return(true)
213
+ allow( docker ).to receive( :sleep ).and_return(true)
202
214
  hosts.each do |host|
203
215
  host['docker_preserve_image']=false
204
216
  end
205
- image.should_receive(:delete)
217
+ expect( image ).to receive(:delete)
206
218
  docker.cleanup
207
219
  end
208
220
 
@@ -223,7 +235,16 @@ module Beaker
223
235
  ]
224
236
  })
225
237
 
226
- dockerfile.should =~ /RUN special one\nRUN special two\nRUN special three/
238
+ expect( dockerfile ).to be =~ /RUN special one\nRUN special two\nRUN special three/
239
+ end
240
+
241
+ it 'should add docker_image_entrypoint' do
242
+ dockerfile = docker.send(:dockerfile_for, {
243
+ 'platform' => 'el-',
244
+ 'docker_image_entrypoint' => '/bin/bash'
245
+ })
246
+
247
+ expect( dockerfile ).to be =~ %r{ENTRYPOINT /bin/bash}
227
248
  end
228
249
 
229
250
  it 'should use zypper on sles' do
@@ -231,7 +252,7 @@ module Beaker
231
252
  'platform' => 'sles',
232
253
  })
233
254
 
234
- dockerfile.should =~ /RUN zypper -n in openssh/
255
+ expect( dockerfile ).to be =~ /RUN zypper -n in openssh/
235
256
  end
236
257
  end
237
258
  end
@@ -4,20 +4,41 @@ require 'beaker/hypervisor/ec2_helper'
4
4
  describe Beaker::EC2Helper do
5
5
  context ".amiports" do
6
6
  let(:ec2) { Beaker::EC2Helper }
7
+
8
+ let(:master_host) do
9
+ opts = { :snapshot => :pe, :roles => ['master'], :additional_ports => 9999 }
10
+ make_host('master', opts)
11
+ end
12
+
13
+ let(:database_host) do
14
+ opts = { :snapshot => :pe, :roles => ['database'], :additional_ports => [1111, 5432] }
15
+ make_host('database', opts)
16
+ end
17
+
18
+ let(:dashboard_host) do
19
+ opts = { :snapshot => :pe, :roles => ['dashboard'], :additional_ports => 2003 }
20
+ make_host('dashboard', opts)
21
+ end
22
+
23
+ let(:all_in_one_host) do
24
+ opts = { :snapshot => :pe, :roles => ['master', 'database', 'dashboard']}
25
+ make_host('all_in_one', opts)
26
+ end
27
+
7
28
  it "can set ports for database host" do
8
- expect(ec2.amiports(["database"])).to be === [22, 61613, 8139, 8080, 8081]
29
+ expect(ec2.amiports(database_host)).to be === [22, 61613, 8139, 5432, 8080, 8081, 1111]
9
30
  end
10
31
 
11
32
  it "can set ports for master host" do
12
- expect(ec2.amiports(["master"])).to be === [22, 61613, 8139, 8140]
33
+ expect(ec2.amiports(master_host)).to be === [22, 61613, 8139, 8140, 9999]
13
34
  end
14
35
 
15
36
  it "can set ports for dashboard host" do
16
- expect(ec2.amiports(["dashboard"])).to be === [22, 61613, 8139, 443, 4435]
37
+ expect(ec2.amiports(dashboard_host)).to be === [22, 61613, 8139, 443, 4433, 4435, 2003]
17
38
  end
18
39
 
19
40
  it "can set ports for combined master/database/dashboard host" do
20
- expect(ec2.amiports(["dashboard", "master", "database"])).to be === [22, 61613, 8139, 8080, 8081, 8140, 443, 4435]
41
+ expect(ec2.amiports(all_in_one_host)).to be === [22, 61613, 8139, 5432, 8080, 8081, 8140, 443, 4433, 4435]
21
42
  end
22
43
  end
23
44
  end
@@ -5,10 +5,10 @@ module Beaker
5
5
  let( :fusion ) { Beaker::Fusion.new( @hosts, make_opts ) }
6
6
 
7
7
  before :each do
8
- stub_const( "Fission::VM", true )
8
+ stub_const( "Fission::VM", true )
9
9
  @hosts = make_hosts()
10
10
  MockFission.presets( @hosts )
11
- Fusion.any_instance.stub( :require ).with( 'fission' ).and_return( true )
11
+ allow_any_instance_of( Fusion ).to receive( :require ).with( 'fission' ).and_return( true )
12
12
  fusion.instance_variable_set( :@fission, MockFission )
13
13
  end
14
14
 
@@ -6,75 +6,68 @@ module Beaker
6
6
 
7
7
  it "creates an aix hypervisor for aix hosts" do
8
8
  aix = double( 'aix' )
9
- aix.stub( :provision ).and_return( true )
9
+ allow( aix ).to receive( :provision ).and_return( true )
10
10
 
11
- Aixer.should_receive( :new ).once.and_return( aix )
11
+ expect( Aixer ).to receive( :new ).once.and_return( aix )
12
12
  expect( hypervisor.create( 'aix', [], make_opts() ) ).to be === aix
13
13
  end
14
14
 
15
15
  it "creates a solaris hypervisor for solaris hosts" do
16
16
  solaris = double( 'solaris' )
17
- solaris.stub( :provision ).and_return( true )
18
- Solaris.should_receive( :new ).once.and_return( solaris )
17
+ allow( solaris ).to receive( :provision ).and_return( true )
18
+ expect( Solaris ).to receive( :new ).once.and_return( solaris )
19
19
  expect( hypervisor.create( 'solaris', [], make_opts() ) ).to be === solaris
20
20
  end
21
21
 
22
22
  it "creates a vsphere hypervisor for vsphere hosts" do
23
23
  vsphere = double( 'vsphere' )
24
- vsphere.stub( :provision ).and_return( true )
25
- Vsphere.should_receive( :new ).once.and_return( vsphere )
24
+ allow( vsphere ).to receive( :provision ).and_return( true )
25
+ expect( Vsphere ).to receive( :new ).once.and_return( vsphere )
26
26
  expect( hypervisor.create( 'vsphere', [], make_opts() ) ).to be === vsphere
27
27
  end
28
28
 
29
29
  it "creates a fusion hypervisor for fusion hosts" do
30
30
  fusion = double( 'fusion' )
31
- fusion.stub( :provision ).and_return( true )
32
- Fusion.should_receive( :new ).once.and_return( fusion )
31
+ allow( fusion ).to receive( :provision ).and_return( true )
32
+ expect( Fusion ).to receive( :new ).once.and_return( fusion )
33
33
  expect( hypervisor.create( 'fusion', [], make_opts() ) ).to be === fusion
34
34
  end
35
35
 
36
36
  it "creates a vcloudpooled hypervisor for vcloud hosts that are pooled" do
37
37
  vcloud = double( 'vcloud' )
38
- vcloud.stub( :provision ).and_return( true )
39
- VcloudPooled.should_receive( :new ).once.and_return( vcloud )
38
+ allow( vcloud ).to receive( :provision ).and_return( true )
39
+ expect( VcloudPooled ).to receive( :new ).once.and_return( vcloud )
40
40
  expect( hypervisor.create( 'vcloud', [], make_opts().merge( { 'pooling_api' => true } ) ) ).to be === vcloud
41
41
  end
42
42
 
43
43
  it "creates a vcloud hypervisor for vcloud hosts that are not pooled" do
44
44
  vcloud = double( 'vcloud' )
45
- vcloud.stub( :provision ).and_return( true )
46
- Vcloud.should_receive( :new ).once.and_return( vcloud )
45
+ allow( vcloud ).to receive( :provision ).and_return( true )
46
+ expect( Vcloud ).to receive( :new ).once.and_return( vcloud )
47
47
  expect( hypervisor.create( 'vcloud', [], make_opts().merge( { 'pooling_api' => false } ) ) ).to be === vcloud
48
48
  end
49
49
 
50
50
  it "creates a vagrant hypervisor for vagrant hosts" do
51
51
  vagrant = double( 'vagrant' )
52
- vagrant.stub( :provision ).and_return( true )
53
- Vagrant.should_receive( :new ).once.and_return( vagrant )
52
+ allow( vagrant ).to receive( :provision ).and_return( true )
53
+ expect( Vagrant ).to receive( :new ).once.and_return( vagrant )
54
54
  expect( hypervisor.create( 'vagrant', [], make_opts() ) ).to be === vagrant
55
55
  end
56
56
 
57
57
  it "creates a vagrant_fusion hypervisor for vagrant vmware fusion hosts" do
58
58
  vagrant = double( 'vagrant_fusion' )
59
- vagrant.stub( :provision ).and_return( true )
60
- VagrantFusion.should_receive( :new ).once.and_return( vagrant )
59
+ allow( vagrant ).to receive( :provision ).and_return( true )
60
+ expect( VagrantFusion ).to receive( :new ).once.and_return( vagrant )
61
61
  expect( hypervisor.create( 'vagrant_fusion', [], make_opts() ) ).to be === vagrant
62
62
  end
63
63
 
64
64
  it "creates a vagrant_virtualbox hypervisor for vagrant virtualbox hosts" do
65
65
  vagrant = double( 'vagrant_virtualbox' )
66
- vagrant.stub( :provision ).and_return( true )
67
- VagrantVirtualbox.should_receive( :new ).once.and_return( vagrant )
66
+ allow( vagrant ).to receive( :provision ).and_return( true )
67
+ expect( VagrantVirtualbox ).to receive( :new ).once.and_return( vagrant )
68
68
  expect( hypervisor.create( 'vagrant_virtualbox', [], make_opts() ) ).to be === vagrant
69
69
  end
70
70
 
71
- it "creates a blimpy hypervisor for blimpy hosts" do
72
- blimpy = double( 'blimpy' )
73
- blimpy.stub( :provision ).and_return( true )
74
- Blimper.should_receive( :new ).once.and_return( blimpy )
75
- expect( hypervisor.create( 'blimpy', [], make_opts() ) ).to be === blimpy
76
- end
77
-
78
71
  context "#configure" do
79
72
  let( :options ) { make_opts.merge({ 'logger' => double().as_null_object }) }
80
73
  let( :hosts ) { make_hosts( { :platform => 'el-5' } ) }
@@ -83,7 +76,7 @@ module Beaker
83
76
  context "if :disable_iptables option set false" do
84
77
  it "does not call disable_iptables" do
85
78
  options[:disable_iptables] = false
86
- hypervisor.should_receive( :disable_iptables ).never
79
+ expect( hypervisor ).to receive( :disable_iptables ).never
87
80
  hypervisor.configure
88
81
  end
89
82
  end
@@ -91,7 +84,7 @@ module Beaker
91
84
  context "if :disable_iptables option set true" do
92
85
  it "calls disable_iptables once" do
93
86
  options[:disable_iptables] = true
94
- hypervisor.should_receive( :disable_iptables ).exactly( 1 ).times
87
+ expect( hypervisor ).to receive( :disable_iptables ).exactly( 1 ).times
95
88
  hypervisor.configure
96
89
  end
97
90
  end