Skip to content

Commit

Permalink
Fix lifecycle spec to actually test moving a disk.
Browse files Browse the repository at this point in the history
Previously, the first_datastore_cpi used datastore pattern that matched
the @second_datastore_within_cluster to create a persistent disk.  This
commit now creates a persistent disk in a different local datastore to
ensure a move happens on attach_disk.

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

Signed-off-by: Aaron Hurley <[email protected]>
  • Loading branch information
flawedmatrix authored and aaronshurley committed Nov 12, 2015
1 parent 650ef48 commit 8c3bae3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/vsphere_cpi/spec/integration/lifecycle_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,10 @@ def second_datastore_cpi
end

context 'given cpis that are configured to use same cluster but different datastores' do
let(:first_datastore_cpi) { @cpi }
let(:first_datastore_cpi) do
options = cpi_options(persistent_datastore_pattern: @datastore_pattern)
described_class.new(options)
end

before do
@vm_id = first_datastore_cpi.create_vm(
Expand All @@ -495,7 +498,7 @@ def second_datastore_cpi
expect(@disk_id).to_not be_nil
expect(first_datastore_cpi.has_disk?(@disk_id)).to be(true)
disk = first_datastore_cpi.disk_provider.find(@disk_id)
expect(disk.datastore.name).to match(@persistent_datastore_pattern)
expect(disk.datastore.name).to match(@datastore_pattern)
end

after {
Expand Down Expand Up @@ -527,6 +530,10 @@ def second_datastore_cpi
end

it '#attach_disk can move the disk to the new datastore pattern' do
if LifecycleHelpers.any_vsan?(@cpi, @datastore_pattern) || LifecycleHelpers.is_vsan?(@cpi, @second_datastore_within_cluster)
skip 'Moving disks between with a vsan datastore is not yet supported'
end

second_datastore_cpi.attach_disk(@vm_id, @disk_id)

disk = second_datastore_cpi.disk_provider.find(@disk_id)
Expand Down

0 comments on commit 8c3bae3

Please sign in to comment.