Skip to content

Commit

Permalink
Add a unit test for boot volume skip on gce.
Browse files Browse the repository at this point in the history
  • Loading branch information
arangamani committed Mar 12, 2014
1 parent 8d299ab commit 6743098
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion spec/unit_test/provider_rightscale_backup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,19 @@
attachment.stub(
:state => 'available',
:device => 'some_device',
:href => 'some_href'
:href => 'some_href',
:resource_uid => 'v-123456'
)
attachment
end

let(:boot_volume_attachment_stub) do
attachment = double('volume_attachment')
attachment.stub(
:state => 'available',
:device => 'some_device',
:href => 'some_href',
:resource_uid => 'projects/example.com:test/disks/boot-i-12345'
)
attachment
end
Expand Down Expand Up @@ -328,6 +340,14 @@ def create_test_volume_type(name, href)
attachment_hrefs = provider.send(:get_volume_attachment_hrefs)
attachment_hrefs.should be_a_kind_of(Array)
end

it "should skip the boot disk attached to the instance" do
client_stub.should_receive(:volume_attachments).and_return(volume_attachment_resource)
volume_attachment_resource.should_receive(:index).and_return([boot_volume_attachment_stub])
attachment_hrefs = provider.send(:get_volume_attachment_hrefs)
attachment_hrefs.should be_a_kind_of(Array)
attachment_hrefs.should be_empty
end
end

describe "#get_cloud_href" do
Expand Down

0 comments on commit 6743098

Please sign in to comment.