Skip to content

Commit

Permalink
Only create the nested ds stemcell when needed
Browse files Browse the repository at this point in the history
We don't need to create that stemcell before running any of the
lifecycle specs only the spec that cares about the nested datacenter

[#103949760](https://www.pivotaltracker.com/story/show/103949760)

Signed-off-by: Jonathan Barnes <[email protected]>
  • Loading branch information
flawedmatrix authored and codeword committed Sep 24, 2015
1 parent 25de5f4 commit 6a76900
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/vsphere_cpi/spec/integration/lifecycle_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@
raise "Corrupt image, tar exit status: #{$?.exitstatus} output: #{output}" if $?.exitstatus != 0
cpi = described_class.new(cpi_options)
@stemcell_id = cpi.create_stemcell("#{temp_dir}/image", nil)
nested_ds_cpi = described_class.new(@nested_datacenter_cpi_options)
@nested_datacenter_stemcell_id = nested_ds_cpi.create_stemcell("#{temp_dir}/image", nil)
end
end

Expand Down Expand Up @@ -101,8 +99,6 @@ def cpi_options(options = {})
after(:all) {
cpi = described_class.new(cpi_options)
cpi.delete_stemcell(@stemcell_id) if @stemcell_id
nested_datacenter_cpi = described_class.new(@nested_datacenter_cpi_options)
nested_datacenter_cpi.delete_stemcell(@nested_datacenter_stemcell_id) if @nested_datacenter_stemcell_id
}

def vm_lifecycle(disk_locality, resource_pool, network_spec, stemcell_id = @stemcell_id)
Expand Down Expand Up @@ -338,8 +334,17 @@ def clean_up_vm_and_disk(cpi)

let(:vlan) { @nested_datacenter_vlan }

before do
Dir.mktmpdir do |temp_dir|
output = `tar -C #{temp_dir} -xzf #{@stemcell_path} 2>&1`
raise "Corrupt image, tar exit status: #{$?.exitstatus} output: #{output}" if $?.exitstatus != 0
@nested_datacenter_stemcell_id = cpi.create_stemcell("#{temp_dir}/image", nil)
end
end

after do
clean_up_vm_and_disk(cpi)
cpi.delete_stemcell(@nested_datacenter_stemcell_id) if @nested_datacenter_stemcell_id
end

it 'exercises the vm lifecycle' do
Expand Down

0 comments on commit 6a76900

Please sign in to comment.