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.
- checksums.yaml +8 -8
- data/.gitignore +1 -0
- data/.rspec +1 -0
- data/CONTRIBUTING.md +1 -0
- data/HISTORY.md +17288 -2
- data/Rakefile +6 -2
- data/beaker.gemspec +15 -19
- data/lib/beaker.rb +2 -5
- data/lib/beaker/answers.rb +2 -0
- data/lib/beaker/answers/version34.rb +37 -1
- data/lib/beaker/cli.rb +4 -0
- data/lib/beaker/command.rb +16 -84
- data/lib/beaker/command_factory.rb +13 -2
- data/lib/beaker/dsl/assertions.rb +25 -2
- data/lib/beaker/dsl/ezbake_utils.rb +2 -2
- data/lib/beaker/dsl/helpers.rb +66 -12
- data/lib/beaker/dsl/install_utils.rb +128 -66
- data/lib/beaker/dsl/wrappers.rb +41 -3
- data/lib/beaker/host.rb +42 -6
- data/lib/beaker/host/mac.rb +62 -0
- data/lib/beaker/host/mac/group.rb +96 -0
- data/lib/beaker/host/mac/user.rb +93 -0
- data/lib/beaker/host/unix/exec.rb +1 -1
- data/lib/beaker/host/unix/pkg.rb +11 -11
- data/lib/beaker/host/windows.rb +4 -4
- data/lib/beaker/host_prebuilt_steps.rb +194 -58
- data/lib/beaker/hypervisor.rb +16 -9
- data/lib/beaker/hypervisor/aws_sdk.rb +61 -17
- data/lib/beaker/hypervisor/docker.rb +14 -2
- data/lib/beaker/hypervisor/ec2_helper.rb +15 -3
- data/lib/beaker/hypervisor/vagrant.rb +22 -10
- data/lib/beaker/hypervisor/vagrant_libvirt.rb +11 -0
- data/lib/beaker/hypervisor/vagrant_virtualbox.rb +1 -1
- data/lib/beaker/hypervisor/vcloud_pooled.rb +8 -39
- data/lib/beaker/logger.rb +15 -9
- data/lib/beaker/network_manager.rb +2 -2
- data/lib/beaker/options/command_line_parser.rb +1 -1
- data/lib/beaker/options/parser.rb +1 -8
- data/lib/beaker/options/presets.rb +70 -45
- data/lib/beaker/perf.rb +3 -4
- data/lib/beaker/platform.rb +2 -1
- data/lib/beaker/result.rb +3 -9
- data/lib/beaker/ssh_connection.rb +2 -0
- data/lib/beaker/test_case.rb +2 -21
- data/lib/beaker/test_suite.rb +21 -25
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/answers_spec.rb +36 -0
- data/spec/beaker/cli_spec.rb +45 -45
- data/spec/beaker/command_spec.rb +25 -36
- data/spec/beaker/dsl/assertions_spec.rb +20 -27
- data/spec/beaker/dsl/ezbake_utils_spec.rb +5 -5
- data/spec/beaker/dsl/helpers_spec.rb +293 -208
- data/spec/beaker/dsl/install_utils_spec.rb +310 -189
- data/spec/beaker/dsl/outcomes_spec.rb +6 -6
- data/spec/beaker/dsl/roles_spec.rb +27 -18
- data/spec/beaker/dsl/structure_spec.rb +11 -11
- data/spec/beaker/dsl/wrappers_spec.rb +35 -11
- data/spec/beaker/host/mac/group_spec.rb +124 -0
- data/spec/beaker/host/mac/user_spec.rb +134 -0
- data/spec/beaker/host/unix/pkg_spec.rb +40 -24
- data/spec/beaker/host/windows/group_spec.rb +1 -1
- data/spec/beaker/host_prebuilt_steps_spec.rb +194 -68
- data/spec/beaker/host_spec.rb +145 -67
- data/spec/beaker/hypervisor/aixer_spec.rb +6 -6
- data/spec/beaker/hypervisor/aws_sdk_spec.rb +22 -7
- data/spec/beaker/hypervisor/docker_spec.rb +71 -50
- data/spec/beaker/hypervisor/ec2_helper_spec.rb +25 -4
- data/spec/beaker/hypervisor/fusion_spec.rb +2 -2
- data/spec/beaker/hypervisor/hypervisor_spec.rb +20 -27
- data/spec/beaker/hypervisor/hypervisor_spec.rb.orig +80 -0
- data/spec/beaker/hypervisor/solaris_spec.rb +8 -8
- data/spec/beaker/hypervisor/vagrant_fusion_spec.rb +6 -8
- data/spec/beaker/hypervisor/vagrant_libvirt_spec.rb +34 -0
- data/spec/beaker/hypervisor/vagrant_spec.rb +34 -33
- data/spec/beaker/hypervisor/vagrant_virtualbox_spec.rb +18 -8
- data/spec/beaker/hypervisor/vagrant_workstation_spec.rb +6 -8
- data/spec/beaker/hypervisor/vcloud_pooled_spec.rb +8 -8
- data/spec/beaker/hypervisor/vcloud_spec.rb +10 -10
- data/spec/beaker/hypervisor/vsphere_helper_spec.rb +8 -8
- data/spec/beaker/hypervisor/vsphere_spec.rb +1 -1
- data/spec/beaker/logger_spec.rb +45 -31
- data/spec/beaker/options/command_line_parser_spec.rb +10 -2
- data/spec/beaker/options/hosts_file_parser_spec.rb +9 -2
- data/spec/beaker/options/options_hash_spec.rb +2 -2
- data/spec/beaker/options/parser_spec.rb +2 -2
- data/spec/beaker/options/pe_version_scaper_spec.rb +6 -1
- data/spec/beaker/options/presets_spec.rb +11 -1
- data/spec/beaker/shared/error_handler_spec.rb +5 -5
- data/spec/beaker/shared/host_manager_spec.rb +3 -2
- data/spec/beaker/shared/repetition_spec.rb +18 -18
- data/spec/beaker/ssh_connection_spec.rb +33 -4
- data/spec/beaker/test_case_spec.rb +9 -9
- data/spec/beaker/test_suite_spec.rb +14 -14
- data/spec/helpers.rb +4 -4
- data/spec/matchers.rb +4 -4
- data/spec/mocks.rb +5 -1
- data/spec/spec_helper.rb +2 -8
- metadata +114 -80
- data/lib/beaker/hypervisor/blimper.rb +0 -108
- data/spec/beaker/hypervisor/blimper_spec.rb +0 -42
- data/spec/beaker/options/data/LATEST +0 -1
- data/spec/beaker/puppet_command_spec.rb +0 -161
- 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.
|
|
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,
|
|
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.
|
|
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
|
|
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.
|
|
64
|
-
aws.
|
|
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.
|
|
18
|
-
logger.
|
|
19
|
-
logger.
|
|
20
|
-
logger.
|
|
21
|
-
logger.
|
|
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.
|
|
28
|
-
image.
|
|
29
|
-
image.
|
|
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.
|
|
36
|
-
container.
|
|
37
|
-
container.
|
|
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.
|
|
51
|
-
container.
|
|
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.
|
|
61
|
-
::Docker.
|
|
62
|
-
::Docker.
|
|
63
|
-
::Docker.
|
|
64
|
-
::Docker
|
|
65
|
-
::Docker::
|
|
66
|
-
::Docker::Container.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
115
|
-
::Docker::Image.
|
|
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.
|
|
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.
|
|
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'].
|
|
146
|
-
hosts[0]['port'].
|
|
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'].
|
|
154
|
-
hosts[0]['port'].
|
|
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'].
|
|
162
|
-
hosts[0]['docker_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.
|
|
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.
|
|
175
|
-
container.
|
|
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.
|
|
181
|
-
container.
|
|
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.
|
|
187
|
-
image.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
-
|
|
8
|
+
stub_const( "Fission::VM", true )
|
|
9
9
|
@hosts = make_hosts()
|
|
10
10
|
MockFission.presets( @hosts )
|
|
11
|
-
Fusion.
|
|
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.
|
|
9
|
+
allow( aix ).to receive( :provision ).and_return( true )
|
|
10
10
|
|
|
11
|
-
Aixer.
|
|
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.
|
|
18
|
-
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.
|
|
25
|
-
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.
|
|
32
|
-
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.
|
|
39
|
-
VcloudPooled.
|
|
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.
|
|
46
|
-
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.
|
|
53
|
-
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.
|
|
60
|
-
VagrantFusion.
|
|
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.
|
|
67
|
-
VagrantVirtualbox.
|
|
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.
|
|
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.
|
|
87
|
+
expect( hypervisor ).to receive( :disable_iptables ).exactly( 1 ).times
|
|
95
88
|
hypervisor.configure
|
|
96
89
|
end
|
|
97
90
|
end
|