bosh-stemcell 1.5.0.pre.1226 → 1.5.0.pre.1244

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 (39) hide show
  1. data/lib/bosh/stemcell/version.rb +1 -1
  2. metadata +6 -75
  3. data/.rspec +0 -3
  4. data/Berksfile +0 -3
  5. data/Berksfile.lock +0 -28
  6. data/Vagrantfile +0 -50
  7. data/bosh-stemcell.gemspec +0 -28
  8. data/spec/assets/fake-stemcell-aws.tgz +0 -0
  9. data/spec/assets/fake-stemcell-vsphere.tgz +0 -0
  10. data/spec/assets/light-fake-stemcell-aws.tgz +0 -0
  11. data/spec/bosh/monkeypatch/serverspec/backend/exec_spec.rb +0 -46
  12. data/spec/bosh/stemcell/archive_filename_spec.rb +0 -56
  13. data/spec/bosh/stemcell/archive_spec.rb +0 -123
  14. data/spec/bosh/stemcell/aws/ami_spec.rb +0 -30
  15. data/spec/bosh/stemcell/aws/light_stemcell_spec.rb +0 -94
  16. data/spec/bosh/stemcell/aws/region_spec.rb +0 -12
  17. data/spec/bosh/stemcell/builder_command_spec.rb +0 -273
  18. data/spec/bosh/stemcell/builder_options_spec.rb +0 -216
  19. data/spec/bosh/stemcell/disk_image_spec.rb +0 -163
  20. data/spec/bosh/stemcell/infrastructure_spec.rb +0 -66
  21. data/spec/bosh/stemcell/operating_system_spec.rb +0 -47
  22. data/spec/bosh/stemcell/stage_collection_spec.rb +0 -279
  23. data/spec/bosh/stemcell/stage_runner_spec.rb +0 -141
  24. data/spec/bosh/stemcell/version_spec.rb +0 -12
  25. data/spec/bosh/stemcell_spec.rb +0 -6
  26. data/spec/spec_helper.rb +0 -6
  27. data/spec/stemcells/aws_spec.rb +0 -9
  28. data/spec/stemcells/centos_spec.rb +0 -146
  29. data/spec/stemcells/go_agent_spec.rb +0 -10
  30. data/spec/stemcells/openstack_spec.rb +0 -9
  31. data/spec/stemcells/ruby_agent_spec.rb +0 -27
  32. data/spec/stemcells/ubuntu_spec.rb +0 -165
  33. data/spec/stemcells/vsphere_spec.rb +0 -9
  34. data/spec/support/rspec_fire.rb +0 -9
  35. data/spec/support/serverspec.rb +0 -4
  36. data/spec/support/spec_assets.rb +0 -11
  37. data/spec/support/stemcell_image.rb +0 -26
  38. data/spec/support/stemcell_shared_examples.rb +0 -27
  39. data/spec/support/stub_env.rb +0 -5
@@ -1,30 +0,0 @@
1
- require 'spec_helper'
2
- require 'bosh/stemcell/aws/ami'
3
-
4
- module Bosh::Stemcell::Aws
5
- describe Ami do
6
- let(:stemcell) do
7
- stemcell = double('Bosh::Dev::Stemcell')
8
- stemcell_manifest = { 'cloud_properties' => { 'ami' => '' } }
9
- stemcell.stub(:extract).and_yield('/foo/bar', stemcell_manifest)
10
- stemcell
11
- end
12
-
13
- subject(:ami) do
14
- Ami.new(stemcell, instance_double('Bosh::Stemcell::Aws::Region', name: 'fake-region'))
15
- end
16
-
17
- before do
18
- Logger.stub(:new)
19
- end
20
-
21
- describe 'publish' do
22
- it 'creates a new ami' do
23
- provider = instance_double('Bosh::AwsCloud::Cloud', create_stemcell: 'fake-ami-id').as_null_object
24
- Bosh::Clouds::Provider.stub(create: provider)
25
-
26
- expect(ami.publish).to eq('fake-ami-id')
27
- end
28
- end
29
- end
30
- end
@@ -1,94 +0,0 @@
1
- require 'spec_helper'
2
- require 'bosh/stemcell/aws/light_stemcell'
3
- require 'bosh/stemcell/archive'
4
-
5
- module Bosh::Stemcell
6
- module Aws
7
- describe LightStemcell do
8
- let(:stemcell) do
9
- Archive.new(spec_asset('fake-stemcell-aws.tgz'))
10
- end
11
-
12
- subject(:light_stemcell) do
13
- LightStemcell.new(stemcell)
14
- end
15
-
16
- its(:path) { should eq(spec_asset('light-fake-stemcell-aws.tgz')) }
17
-
18
- describe '#write_archive' do
19
- let(:region) do
20
- instance_double('Bosh::Stemcell::Aws::Region', name: 'fake-region')
21
- end
22
-
23
- let(:ami) do
24
- instance_double('Bosh::Stemcell::Aws::Ami', publish: 'fake-ami-id')
25
- end
26
-
27
- let(:stemcell) do
28
- Archive.new(spec_asset('fake-stemcell-aws.tgz'))
29
- end
30
-
31
- subject(:light_stemcell) do
32
- LightStemcell.new(stemcell)
33
- end
34
-
35
- before do
36
- Region.stub(new: region)
37
- Ami.stub(:new).with(stemcell, region).and_return(ami)
38
- Rake::FileUtilsExt.stub(:sh)
39
- FileUtils.stub(:touch)
40
- end
41
-
42
- it 'creates an ami from the stemcell' do
43
- ami.should_receive(:publish)
44
-
45
- light_stemcell.write_archive
46
- end
47
-
48
- it 'creates a new tgz' do
49
- Rake::FileUtilsExt.should_receive(:sh) do |command|
50
- command.should match(/tar xzf #{stemcell.path} --directory .*/)
51
- end
52
-
53
- expected_tarfile = File.join(File.dirname(stemcell.path), 'light-fake-stemcell-aws.tgz')
54
-
55
- Rake::FileUtilsExt.should_receive(:sh) do |command|
56
- command.should match(/sudo tar cvzf #{expected_tarfile} \*/)
57
- end
58
-
59
- light_stemcell.write_archive
60
- end
61
-
62
- it 'replaces the raw image with a blank placeholder' do
63
- FileUtils.should_receive(:touch).and_return do |file, options|
64
- expect(file).to match('image')
65
- expect(options).to eq(verbose: true)
66
- end
67
- light_stemcell.write_archive
68
- end
69
-
70
- it 'adds the ami to the stemcell manifest' do
71
- Psych.should_receive(:dump).and_return do |stemcell_properties, out|
72
- expect(stemcell_properties['cloud_properties']['ami']).to eq({ 'fake-region' => 'fake-ami-id' })
73
- end
74
-
75
- light_stemcell.write_archive
76
- end
77
-
78
- it 'names the stemcell manifest correctly' do
79
- # Example fails on linux without File.stub
80
- File.stub(:open).and_call_original
81
- File.should_receive(:open).with('stemcell.MF', 'w')
82
-
83
- light_stemcell.write_archive
84
- end
85
-
86
- it 'does not mutate original stemcell manifest' do
87
- expect {
88
- light_stemcell.write_archive
89
- }.not_to change { stemcell.manifest['cloud_properties'] }
90
- end
91
- end
92
- end
93
- end
94
- end
@@ -1,12 +0,0 @@
1
- require 'spec_helper'
2
- require 'bosh/stemcell/aws/region'
3
-
4
- module Bosh::Stemcell::Aws
5
- describe Region do
6
- it 'queries AWS for its region' do
7
- az_query = '/latest/meta-data/placement/availability-zone'
8
- Net::HTTP.stub(:get).with('169.254.169.254', az_query).and_return("us-east-1\n")
9
- expect(subject.name).to eq 'us-east-1'
10
- end
11
- end
12
- end
@@ -1,273 +0,0 @@
1
- require 'spec_helper'
2
- require 'bosh/stemcell/builder_command'
3
-
4
- module Bosh::Stemcell
5
- describe BuilderCommand do
6
- subject(:stemcell_builder_command) do
7
- described_class.new(
8
- env,
9
- infrastructure_name: infrastructure.name,
10
- operating_system_name: operating_system.name,
11
- agent_name: agent_name,
12
- release_tarball_path: release_tarball_path,
13
- version: version
14
- )
15
- end
16
-
17
- let(:env) { {} }
18
-
19
- let(:agent_name) { 'ruby' }
20
- let(:expected_agent_name) { 'ruby' }
21
-
22
- let(:infrastructure) do
23
- instance_double(
24
- 'Bosh::Stemcell::Infrastructure::Vsphere',
25
- name: 'vsphere',
26
- hypervisor: 'esxi'
27
- )
28
- end
29
-
30
- let(:operating_system) { instance_double('Bosh::Stemcell::OperatingSystem::Ubuntu', name: 'ubuntu') }
31
- let(:release_tarball_path) { "/fake/path/to/bosh-#{version}.tgz" }
32
- let(:version) { '007' }
33
-
34
- before do
35
- Infrastructure.stub(:for).with('vsphere').and_return(infrastructure)
36
- OperatingSystem.stub(:for).with(operating_system.name).and_return(operating_system)
37
- StageCollection.stub(:new).with(
38
- infrastructure: infrastructure,
39
- operating_system: operating_system,
40
- agent_name: agent_name,
41
- ).and_return(stage_collection)
42
-
43
- StageRunner.stub(:new).with(
44
- build_path: File.join(root_dir, 'build', 'build'),
45
- command_env: 'env ',
46
- settings_file: settings_file,
47
- work_path: File.join(root_dir, 'work')
48
- ).and_return(stage_runner)
49
-
50
- BuilderOptions.stub(:new).with(
51
- env,
52
- tarball: release_tarball_path,
53
- stemcell_version: version,
54
- infrastructure: infrastructure,
55
- operating_system: operating_system,
56
- agent_name: expected_agent_name,
57
- ).and_return(stemcell_builder_options)
58
- end
59
-
60
- let(:root_dir) do
61
- File.join('/mnt/stemcells', infrastructure.name, infrastructure.hypervisor, operating_system.name)
62
- end
63
-
64
- let(:stemcell_builder_options) do
65
- instance_double('Bosh::Stemcell::BuilderOptions', default: options)
66
- end
67
-
68
- let(:stage_collection) do
69
- instance_double(
70
- 'Bosh::Stemcell::StageCollection',
71
- all_stages: %w(FAKE_OS_STAGES FAKE_INFRASTRUCTURE_STAGES)
72
- )
73
- end
74
-
75
- let(:stage_runner) { instance_double('Bosh::Stemcell::StageRunner', configure_and_apply: nil) }
76
-
77
- let(:etc_dir) { File.join(root_dir, 'build', 'build', 'etc') }
78
- let(:settings_file) { File.join(etc_dir, 'settings.bash') }
79
-
80
- let(:options) do
81
- {
82
- 'hello' => 'world',
83
- 'stemcell_tgz' => 'fake-stemcell.tgz',
84
- 'stemcell_image_name' => 'fake-root-disk-image.raw'
85
- }
86
- end
87
-
88
- its(:chroot_dir) { should eq(File.join(root_dir, 'work', 'work', 'chroot')) }
89
-
90
- describe '#build' do
91
- include FakeFS::SpecHelpers
92
-
93
- before do
94
- Process.stub(pid: 99999)
95
-
96
- stemcell_builder_command.stub(system: true)
97
- FileUtils.touch('leftover.tgz')
98
-
99
- FileUtils.stub(:cp_r).with([], File.join(root_dir, 'build', 'build'), preserve: true, verbose: true) do
100
- FileUtils.mkdir_p(etc_dir)
101
- FileUtils.touch(settings_file)
102
- end
103
- end
104
-
105
- context 'when agent_name is nil' do
106
- let(:agent_name) { nil }
107
- let(:expected_agent_name) { 'ruby' }
108
-
109
- it 'uses the correct agent name for the stage collection' do
110
- StageCollection.should_receive(:new).with(
111
- infrastructure: infrastructure,
112
- operating_system: operating_system,
113
- agent_name: expected_agent_name,
114
- ).and_return(stage_collection)
115
-
116
- stemcell_builder_command.build
117
- end
118
- end
119
-
120
- context 'when agent_name is foo' do
121
- let(:agent_name) { 'foo' }
122
- let(:expected_agent_name) { 'foo' }
123
-
124
- it 'uses the correct agent name for the stage collection' do
125
- StageCollection.should_receive(:new).with(
126
- infrastructure: infrastructure,
127
- operating_system: operating_system,
128
- agent_name: expected_agent_name,
129
- ).and_return(stage_collection)
130
-
131
- stemcell_builder_command.build
132
- end
133
- end
134
-
135
- describe 'sanitizing the environment' do
136
- it 'removes any tgz files from current working directory' do
137
- expect {
138
- stemcell_builder_command.build
139
- }.to change { Dir.glob('*.tgz').size }.to(0)
140
- end
141
-
142
- it 'unmounts the disk image used to install Grub' do
143
- image_path = File.join(root_dir, 'work/work/mnt/tmp/grub/fake-root-disk-image.raw')
144
- unmount_img_command = "sudo umount #{image_path} 2> /dev/null"
145
- stemcell_builder_command.should_receive(:system).with(unmount_img_command)
146
- stemcell_builder_command.build
147
- end
148
-
149
- it 'unmounts work/work/mnt directory' do
150
- unmount_dir_command = "sudo umount #{File.join(root_dir, 'work/work/mnt')} 2> /dev/null"
151
- stemcell_builder_command.should_receive(:system).with(unmount_dir_command)
152
- stemcell_builder_command.build
153
- end
154
-
155
- it 'removes stemcell root directory' do
156
- stemcell_builder_command.should_receive(:system).with("sudo rm -rf #{root_dir}")
157
- stemcell_builder_command.build
158
- end
159
- end
160
-
161
- it 'returns the full path of the generated stemcell archive' do
162
- expect(stemcell_builder_command.build).to eq(File.join(root_dir, 'work', 'work', 'fake-stemcell.tgz'))
163
- end
164
-
165
- it 'creates a base directory for stemcell creation' do
166
- expect {
167
- stemcell_builder_command.build
168
- }.to change { Dir.exists?(root_dir) }.from(false).to(true)
169
- end
170
-
171
- it 'creates a build directory for stemcell creation' do
172
- expect {
173
- stemcell_builder_command.build
174
- }.to change { Dir.exists?(File.join(root_dir, 'build')) }.from(false).to(true)
175
- end
176
-
177
- it 'copies the stemcell_builder code into the build directory' do
178
- FileUtils.should_receive(:cp_r).with([],
179
- File.join(root_dir, 'build', 'build'),
180
- preserve: true,
181
- verbose: true) do
182
- FileUtils.mkdir_p(etc_dir)
183
- FileUtils.touch(settings_file)
184
- end
185
-
186
- stemcell_builder_command.build
187
- end
188
-
189
- it 'creates a work directory for stemcell creation chroot' do
190
- expect {
191
- stemcell_builder_command.build
192
- }.to change { Dir.exists?(File.join(root_dir, 'work')) }.from(false).to(true)
193
- end
194
-
195
- it 'writes a settings file into the build directory' do
196
- stemcell_builder_command.build
197
-
198
- expect(File.read(settings_file)).to match(/hello=world/)
199
- end
200
-
201
- describe 'running stages' do
202
- let(:expected_rspec_command) do
203
- [
204
- "cd #{File.expand_path('../../..', File.dirname(__FILE__))};",
205
- "STEMCELL_IMAGE=#{File.join(root_dir, 'work', 'work', 'fake-root-disk-image.raw')}",
206
- 'bundle exec rspec -fd',
207
- "spec/stemcells/#{operating_system.name}_spec.rb",
208
- "spec/stemcells/#{agent_name}_agent_spec.rb",
209
- "spec/stemcells/#{infrastructure.name}_spec.rb",
210
- ].join(' ')
211
- end
212
-
213
- it 'calls #configure_and_apply' do
214
- stage_runner.should_receive(:configure_and_apply).
215
- with(%w(FAKE_OS_STAGES FAKE_INFRASTRUCTURE_STAGES)).ordered
216
- stemcell_builder_command.should_receive(:system).
217
- with(expected_rspec_command).ordered
218
-
219
- stemcell_builder_command.build
220
- end
221
-
222
- context 'with CentOS' do
223
- let(:operating_system) { instance_double('Bosh::Stemcell::OperatingSystem::Centos', name: 'centos') }
224
-
225
- it 'calls #configure_and_apply' do
226
- stage_runner.should_receive(:configure_and_apply).
227
- with(%w(FAKE_OS_STAGES FAKE_INFRASTRUCTURE_STAGES)).ordered
228
- stemcell_builder_command.should_receive(:system).
229
- with(expected_rspec_command).ordered
230
-
231
- stemcell_builder_command.build
232
- end
233
- end
234
- end
235
-
236
- context 'when ENV contains variables besides HTTP_PROXY and NO_PROXY' do
237
- let(:env) do
238
- {
239
- 'NOT_HTTP_PROXY' => 'nice_proxy',
240
- 'no_proxy_just_kidding' => 'naughty_proxy'
241
- }
242
- end
243
-
244
- it 'nothing is passed to sudo via "env"' do
245
- StageRunner.stub(:new).with(build_path: File.join(root_dir, 'build', 'build'),
246
- command_env: 'env ',
247
- settings_file: settings_file,
248
- work_path: File.join(root_dir, 'work')).and_return(stage_runner)
249
-
250
- stemcell_builder_command.build
251
- end
252
- end
253
-
254
- context 'ENV variables for HTTP_PROXY and NO_PROXY are passed to "env"' do
255
- let(:env) do
256
- {
257
- 'HTTP_PROXY' => 'nice_proxy',
258
- 'no_proxy' => 'naughty_proxy'
259
- }
260
- end
261
-
262
- it 'they are passed to sudo via "env"' do
263
- StageRunner.stub(:new).with(build_path: File.join(root_dir, 'build', 'build'),
264
- command_env: "env HTTP_PROXY='nice_proxy' no_proxy='naughty_proxy'",
265
- settings_file: settings_file,
266
- work_path: File.join(root_dir, 'work')).and_return(stage_runner)
267
-
268
- stemcell_builder_command.build
269
- end
270
- end
271
- end
272
- end
273
- end
@@ -1,216 +0,0 @@
1
- require 'spec_helper'
2
- require 'bosh/stemcell/builder_options'
3
- require 'bosh/stemcell/infrastructure'
4
- require 'bosh/stemcell/operating_system'
5
-
6
- module Bosh::Stemcell
7
- describe BuilderOptions do
8
- subject(:stemcell_builder_options) { described_class.new(env, options) }
9
- let(:env) { {} }
10
- let(:options) do
11
- {
12
- tarball: 'fake/release.tgz',
13
- stemcell_version: '007',
14
- infrastructure: infrastructure,
15
- operating_system: operating_system,
16
- agent_name: agent_name,
17
- }
18
- end
19
-
20
- let(:infrastructure) { Infrastructure.for('aws') }
21
- let(:operating_system) { OperatingSystem.for('ubuntu') }
22
- let(:agent_name) { 'ruby' }
23
- let(:expected_source_root) { File.expand_path('../../../../..', __FILE__) }
24
- let(:archive_filename) { instance_double('Bosh::Stemcell::ArchiveFilename', to_s: 'FAKE_STEMCELL.tgz') }
25
-
26
- before do
27
- ArchiveFilename.stub(:new).
28
- with('007', infrastructure, operating_system, 'bosh-stemcell', false, agent_name).and_return(archive_filename)
29
- end
30
-
31
- describe '#initialize' do
32
- context 'when :tarball is not set' do
33
- before { options.delete(:tarball) }
34
-
35
- it 'dies' do
36
- expect { stemcell_builder_options }.to raise_error('key not found: :tarball')
37
- end
38
- end
39
-
40
- context 'when :stemcell_version is not set' do
41
- before { options.delete(:stemcell_version) }
42
-
43
- it 'dies' do
44
- expect { stemcell_builder_options }.to raise_error('key not found: :stemcell_version')
45
- end
46
- end
47
-
48
- context 'when :infrastructure is not set' do
49
- before { options.delete(:infrastructure) }
50
-
51
- it 'dies' do
52
- expect { stemcell_builder_options }.to raise_error('key not found: :infrastructure')
53
- end
54
- end
55
-
56
- context 'when :operating_system is not set' do
57
- before { options.delete(:operating_system) }
58
-
59
- it 'dies' do
60
- expect { stemcell_builder_options }.to raise_error('key not found: :operating_system')
61
- end
62
- end
63
- end
64
-
65
- describe '#default' do
66
- let(:default_disk_size) { 2048 }
67
- let(:rake_args) { {} }
68
-
69
- it 'sets stemcell_tgz' do
70
- result = stemcell_builder_options.default
71
- expect(result['stemcell_tgz']).to eq(archive_filename.to_s)
72
- end
73
-
74
- it 'sets stemcell_image_name' do
75
- result = stemcell_builder_options.default
76
- expected_image_name = "#{infrastructure.name}-#{infrastructure.hypervisor}-#{operating_system.name}.raw"
77
- expect(result['stemcell_image_name']).to eq(expected_image_name)
78
- end
79
-
80
- it 'sets stemcell_version' do
81
- result = stemcell_builder_options.default
82
- expect(result['stemcell_version']).to eq('007')
83
- end
84
-
85
- # rubocop:disable MethodLength
86
- def self.it_sets_correct_environment_variables
87
- describe 'setting enviroment variables' do
88
- let(:env) do
89
- {
90
- 'UBUNTU_ISO' => 'fake_ubuntu_iso',
91
- 'UBUNTU_MIRROR' => 'fake_ubuntu_mirror',
92
- 'RUBY_BIN' => 'fake_ruby_bin',
93
- }
94
- end
95
-
96
- it 'sets default values for options based in hash' do
97
- expected_release_micro_manifest_path =
98
- File.join(expected_source_root, "release/micro/#{infrastructure.name}.yml")
99
-
100
- result = stemcell_builder_options.default
101
-
102
- expect(result['stemcell_name']).to eq(
103
- "bosh-#{infrastructure.name}-#{infrastructure.hypervisor}-#{operating_system.name}")
104
- expect(result['stemcell_operating_system']).to eq(operating_system.name)
105
- expect(result['stemcell_infrastructure']).to eq(infrastructure.name)
106
- expect(result['stemcell_hypervisor']).to eq(infrastructure.hypervisor)
107
- expect(result['bosh_protocol_version']).to eq('1')
108
- expect(result['UBUNTU_ISO']).to eq('fake_ubuntu_iso')
109
- expect(result['UBUNTU_MIRROR']).to eq('fake_ubuntu_mirror')
110
- expect(result['ruby_bin']).to eq('fake_ruby_bin')
111
- expect(result['bosh_release_src_dir']).to eq(File.join(expected_source_root, '/release/src/bosh'))
112
- expect(result['bosh_agent_src_dir']).to eq(File.join(expected_source_root, 'bosh_agent'))
113
- expect(result['go_agent_src_dir']).to eq(File.join(expected_source_root, 'go_agent'))
114
- expect(result['image_create_disk_size']).to eq(default_disk_size)
115
- expect(result['bosh_micro_enabled']).to eq('yes')
116
- expect(result['bosh_micro_package_compiler_path']).to eq(
117
- File.join(expected_source_root, 'bosh-release'))
118
- expect(result['bosh_micro_manifest_yml_path']).to eq(expected_release_micro_manifest_path)
119
- expect(result['bosh_micro_release_tgz_path']).to eq('fake/release.tgz')
120
- end
121
-
122
- context 'when RUBY_BIN is not set' do
123
- before { env.delete('RUBY_BIN') }
124
-
125
- before do
126
- RbConfig::CONFIG.stub(:[]).with('bindir').and_return('/a/path/to/')
127
- RbConfig::CONFIG.stub(:[]).with('ruby_install_name').and_return('ruby')
128
- end
129
-
130
- it 'uses the RbConfig values' do
131
- result = stemcell_builder_options.default
132
-
133
- expect(result['ruby_bin']).to eq('/a/path/to/ruby')
134
- end
135
- end
136
-
137
- context 'when disk_size is not passed' do
138
- it 'defaults to default disk size for infrastructure' do
139
- result = stemcell_builder_options.default
140
-
141
- expect(result['image_create_disk_size']).to eq(default_disk_size)
142
- end
143
- end
144
-
145
- context 'when disk_size is passed' do
146
- before { options.merge!(disk_size: 1234) }
147
-
148
- it 'allows user to override default disk_size' do
149
- result = stemcell_builder_options.default
150
-
151
- expect(result['image_create_disk_size']).to eq(1234)
152
- end
153
- end
154
-
155
- context 'when go agent is used' do
156
- let(:agent_name) { 'go' }
157
-
158
- it 'changes the stemcell_name' do
159
- result = stemcell_builder_options.default
160
-
161
- expect(result['stemcell_name']).to eq(
162
- "bosh-#{infrastructure.name}-#{infrastructure.hypervisor}-#{operating_system.name}-go_agent")
163
- end
164
- end
165
- end
166
- end
167
- # rubocop:enable MethodLength
168
-
169
- describe 'infrastructure variation' do
170
- context 'when infrastruture is aws' do
171
- let(:infrastructure) { Infrastructure.for('aws') }
172
-
173
- it_sets_correct_environment_variables
174
-
175
- it 'has no "image_vsphere_ovf_ovftool_path" key' do
176
- expect(stemcell_builder_options.default).not_to have_key('image_vsphere_ovf_ovftool_path')
177
- end
178
- end
179
-
180
- context 'when infrastruture is vsphere' do
181
- let(:infrastructure) { Infrastructure.for('vsphere') }
182
- let(:default_disk_size) { 3072 }
183
-
184
- it_sets_correct_environment_variables
185
-
186
- it 'has an "image_vsphere_ovf_ovftool_path" key' do
187
- result = stemcell_builder_options.default
188
-
189
- expect(result['image_vsphere_ovf_ovftool_path']).to be_nil
190
- end
191
-
192
- context 'if you have OVFTOOL set in the environment' do
193
- let(:env) { { 'OVFTOOL' => 'fake_ovf_tool_path' } }
194
-
195
- it 'sets image_vsphere_ovf_ovftool_path' do
196
- result = stemcell_builder_options.default
197
-
198
- expect(result['image_vsphere_ovf_ovftool_path']).to eq('fake_ovf_tool_path')
199
- end
200
- end
201
- end
202
-
203
- context 'when infrastructure is openstack' do
204
- let(:infrastructure) { Infrastructure.for('openstack') }
205
- let(:default_disk_size) { 10240 }
206
-
207
- it_sets_correct_environment_variables
208
-
209
- it 'has no "image_vsphere_ovf_ovftool_path" key' do
210
- expect(stemcell_builder_options.default).not_to have_key('image_vsphere_ovf_ovftool_path')
211
- end
212
- end
213
- end
214
- end
215
- end
216
- end