Sha256: f7c58b3bd6a59023de49768df00051c3b841491fa5a3869fca01ed9e4836b442

Contents?: true

Size: 1.25 KB

Versions: 11

Compression:

Stored size: 1.25 KB

Contents

require File.dirname(__FILE__) + '/../../../spec_helper'

describe 'EC2.detach_volume' do
  describe 'success' do

    before(:each) do
      @instance_id = ec2.run_instances(GENTOO_AMI, 1, 1, {'Placement.AvailabilityZone' => 'us-east-1a'}).body['instancesSet'].first['instanceId']
      @volume_id = ec2.create_volume('us-east-1a', 1).body['volumeId']
      eventually(128) do
        ec2.attach_volume(@instance_id, @volume_id, '/dev/sdh')
      end
    end

    after(:each) do
      eventually do
        ec2.delete_volume(@volume_id)
        ec2.terminate_instances([@instance_id])
      end
    end

    it "should return proper attributes" do
      eventually do
        actual = ec2.detach_volume(@volume_id)
        actual.body['attachTime'].should be_a(Time)
        actual.body['device'].should be_a(String)
        actual.body['instanceId'].should be_a(String)
        actual.body['requestId'].should be_a(String)
        actual.body['status'].should be_a(String)
        actual.body['volumeId'].should be_a(String)
      end
    end

  end
  describe 'failure' do

    it "should raise a BadRequest error if the volume does not exist" do
      lambda {
        ec2.detach_volume('vol-00000000')
      }.should raise_error(Excon::Errors::BadRequest)
    end

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
fog-0.0.40 spec/aws/requests/ec2/detach_volume_spec.rb
fog-0.0.39 spec/aws/requests/ec2/detach_volume_spec.rb
fog-0.0.38 spec/aws/requests/ec2/detach_volume_spec.rb
fog-0.0.37 spec/aws/requests/ec2/detach_volume_spec.rb
fog-0.0.36 spec/aws/requests/ec2/detach_volume_spec.rb
fog-0.0.35 spec/aws/requests/ec2/detach_volume_spec.rb
fog-0.0.34 spec/aws/requests/ec2/detach_volume_spec.rb
fog-0.0.33 spec/aws/requests/ec2/detach_volume_spec.rb
fog-0.0.32 spec/aws/requests/ec2/detach_volume_spec.rb
fog-0.0.31 spec/aws/requests/ec2/detach_volume_spec.rb
fog-0.0.30 spec/aws/requests/ec2/detach_volume_spec.rb