mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[ec2] remove deprecated request specs, replaced by shindo tests
This commit is contained in:
parent
945011661f
commit
c1442ad780
13 changed files with 0 additions and 472 deletions
|
@ -1,18 +0,0 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.allocate_address' do
|
||||
describe 'success' do
|
||||
|
||||
after(:each) do
|
||||
AWS[:ec2].release_address(@public_ip)
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = AWS[:ec2].allocate_address
|
||||
actual.body['requestId'].should be_a(String)
|
||||
@public_ip = actual.body['publicIp']
|
||||
actual.body['publicIp'].should be_a(String)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -1,43 +0,0 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.associate_address' do
|
||||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
@instance_id = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
|
||||
@public_ip = AWS[:ec2].allocate_address.body['publicIp']
|
||||
AWS[:ec2].servers.get(@instance_id).wait_for { ready? }
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
AWS[:ec2].release_address(@public_ip)
|
||||
AWS[:ec2].terminate_instances(@instance_id)
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = AWS[:ec2].associate_address(@instance_id, @public_ip)
|
||||
actual.body['requestId'].should be_a(String)
|
||||
[false, true].should include(actual.body['return'])
|
||||
end
|
||||
|
||||
end
|
||||
describe 'failure' do
|
||||
|
||||
it "should raise a BadRequest error if the instance does not exist" do
|
||||
@public_ip = AWS[:ec2].allocate_address.body['publicIp']
|
||||
lambda {
|
||||
AWS[:ec2].associate_address('i-00000000', @public_ip)
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
AWS[:ec2].release_address(@public_ip)
|
||||
end
|
||||
|
||||
it "should raise a BadRequest error if the address does not exist" do
|
||||
@instance_id = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
|
||||
lambda {
|
||||
AWS[:ec2].associate_address(@instance_id, '127.0.0.1')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
AWS[:ec2].terminate_instances(@instance_id)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -1,51 +0,0 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.attach_volume' do
|
||||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
@instance_id = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1, {'Placement.AvailabilityZone' => 'us-east-1a'}).body['instancesSet'].first['instanceId']
|
||||
@volume_id = AWS[:ec2].create_volume('us-east-1a', 1).body['volumeId']
|
||||
AWS[:ec2].servers.get(@instance_id).wait_for { ready? }
|
||||
AWS[:ec2].volumes.get(@volume_id).wait_for { ready? }
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
AWS[:ec2].volumes.get(@volume_id).wait_for { state == 'attached' }
|
||||
AWS[:ec2].detach_volume(@volume_id)
|
||||
AWS[:ec2].volumes.get(@volume_id).wait_for { ready? }
|
||||
AWS[:ec2].delete_volume(@volume_id)
|
||||
AWS[:ec2].terminate_instances(@instance_id)
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = AWS[:ec2].attach_volume(@instance_id, @volume_id, '/dev/sdh')
|
||||
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
|
||||
describe 'failure' do
|
||||
|
||||
it "should raise a BadRequest error if the instance does not exist" do
|
||||
@volume_id = AWS[:ec2].create_volume('us-east-1a', 1).body['volumeId']
|
||||
lambda {
|
||||
AWS[:ec2].attach_volume('i-00000000', @volume_id, '/dev/sdh')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
AWS[:ec2].delete_volume(@volume_id)
|
||||
end
|
||||
|
||||
it "should raise a BadRequest error if the volume does not exist" do
|
||||
@instance_id = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
|
||||
lambda {
|
||||
AWS[:ec2].attach_volume(@instance_id, 'vol-00000000', '/dev/sdh')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
AWS[:ec2].terminate_instances(@instance_id)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -1,36 +0,0 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.create_snapshot' do
|
||||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
@volume_id = AWS[:ec2].create_volume('us-east-1a', 1).body['volumeId']
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
AWS[:ec2].delete_volume(@volume_id)
|
||||
AWS[:ec2].snapshots.get(@snapshot_id).wait_for { ready? }
|
||||
AWS[:ec2].delete_snapshot(@snapshot_id)
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = AWS[:ec2].create_snapshot(@volume_id)
|
||||
actual.body['progress'].should be_nil
|
||||
@snapshot_id = actual.body['snapshotId']
|
||||
actual.body['snapshotId'].should be_a(String)
|
||||
actual.body['startTime'].should be_a(Time)
|
||||
actual.body['status'].should be_a(String)
|
||||
actual.body['volumeId'].should be_a(String)
|
||||
end
|
||||
|
||||
end
|
||||
describe 'failure' do
|
||||
|
||||
it "should raise a BadRequest error if the volume does not exist" do
|
||||
lambda {
|
||||
AWS[:ec2].create_snapshot('vol-00000000')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -1,23 +0,0 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.create_volume' do
|
||||
describe 'success' do
|
||||
|
||||
after(:each) do
|
||||
AWS[:ec2].delete_volume(@volume_id)
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = AWS[:ec2].create_volume('us-east-1a', 1)
|
||||
actual.body['availabilityZone'].should be_a(String)
|
||||
actual.body['createTime'].should be_a(Time)
|
||||
actual.body['requestId'].should be_a(String)
|
||||
actual.body['size'].should == 1
|
||||
actual.body['snapshotId'].should be_nil
|
||||
actual.body['status'].should be_a(String)
|
||||
actual.body['volumeId'].should be_a(String)
|
||||
@volume_id = actual.body['volumeId']
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -1,34 +0,0 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.delete_snapshot' do
|
||||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
@volume_id = AWS[:ec2].create_volume('us-east-1a', 1).body['volumeId']
|
||||
@snapshot_id = AWS[:ec2].create_snapshot(@volume_id).body['snapshotId']
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
AWS[:ec2].delete_volume(@volume_id)
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
AWS[:ec2].snapshots.get(@snapshot_id).wait_for { ready? }
|
||||
actual = AWS[:ec2].delete_snapshot(@snapshot_id)
|
||||
unless actual.body.empty?
|
||||
actual.body['requestId'].should be_a(String)
|
||||
[false, true].should include(actual.body['return'])
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
describe 'failure' do
|
||||
|
||||
it "should raise a BadRequest error if snapshot does not exist" do
|
||||
lambda {
|
||||
AWS[:ec2].release_address('snap-00000000')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -1,26 +0,0 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.create_volume' do
|
||||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
@volume_id = AWS[:ec2].create_volume('us-east-1a', 1).body['volumeId']
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = AWS[:ec2].delete_volume(@volume_id)
|
||||
actual.body['requestId'].should be_a(String)
|
||||
actual.body['return'].should == true
|
||||
end
|
||||
|
||||
end
|
||||
describe 'failure' do
|
||||
|
||||
it "should raise a BadRequest error if volume does not exist" do
|
||||
lambda {
|
||||
AWS[:ec2].delete_volume('vol-00000000')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -1,38 +0,0 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.describe_addresses' do
|
||||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
@public_ip = AWS[:ec2].allocate_address.body['publicIp']
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
AWS[:ec2].release_address(@public_ip)
|
||||
end
|
||||
|
||||
it "should return proper attributes with no params" do
|
||||
actual = AWS[:ec2].describe_addresses
|
||||
actual.body['requestId'].should be_a(String)
|
||||
item = actual.body['addressesSet'].select {|address| address['publicIp'] == @public_ip}
|
||||
item.should_not be_nil
|
||||
end
|
||||
|
||||
it "should return proper attributes for specific ip" do
|
||||
actual = AWS[:ec2].describe_addresses(@public_ip)
|
||||
actual.body['requestId'].should be_a(String)
|
||||
item = actual.body['addressesSet'].select {|address| address['publicIp'] == @public_ip}
|
||||
item.should_not be_nil
|
||||
end
|
||||
|
||||
end
|
||||
describe 'failure' do
|
||||
|
||||
it "should raise a BadRequest error if ip does not exist" do
|
||||
lambda {
|
||||
AWS[:ec2].describe_addresses('127.0.0.1')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -1,50 +0,0 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.describe_snapshots' do
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
@volume_id = AWS[:ec2].create_volume('us-east-1a', 1).body['volumeId']
|
||||
AWS[:ec2].volumes.get(@volume_id).wait_for { ready? }
|
||||
@snapshot_id = AWS[:ec2].create_snapshot(@volume_id).body['snapshotId']
|
||||
AWS[:ec2].snapshots.get(@snapshot_id).wait_for { ready? }
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
AWS[:ec2].delete_volume(@volume_id)
|
||||
AWS[:ec2].delete_snapshot(@snapshot_id)
|
||||
end
|
||||
|
||||
it "should return proper attributes with no params" do
|
||||
actual = AWS[:ec2].describe_snapshots
|
||||
actual.body['snapshotSet'].should be_an(Array)
|
||||
snapshot = actual.body['snapshotSet'].select {|snapshot| snapshot['snapshotId'] == @snapshot_id}.first
|
||||
snapshot['progress'].should be_a(String)
|
||||
snapshot['snapshotId'].should be_a(String)
|
||||
snapshot['startTime'].should be_a(Time)
|
||||
snapshot['status'].should be_a(String)
|
||||
snapshot['volumeId'].should be_a(String)
|
||||
end
|
||||
|
||||
it "should return proper attributes with params" do
|
||||
actual = AWS[:ec2].describe_snapshots([@snapshot_id])
|
||||
actual.body['snapshotSet'].should be_an(Array)
|
||||
snapshot = actual.body['snapshotSet'].select {|snapshot| snapshot['snapshotId'] == @snapshot_id}.first
|
||||
snapshot['progress'].should be_a(String)
|
||||
snapshot['snapshotId'].should be_a(String)
|
||||
snapshot['startTime'].should be_a(Time)
|
||||
snapshot['status'].should be_a(String)
|
||||
snapshot['volumeId'].should be_a(String)
|
||||
end
|
||||
|
||||
end
|
||||
describe 'failure' do
|
||||
|
||||
it "should raise a BadRequest error if the snapshot does not exist" do
|
||||
lambda {
|
||||
AWS[:ec2].describe_snapshots('snap-00000000')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -1,50 +0,0 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.describe_volumes' do
|
||||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
@volume_id = AWS[:ec2].create_volume('us-east-1a', 1).body['volumeId']
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
AWS[:ec2].delete_volume(@volume_id)
|
||||
end
|
||||
|
||||
it "should return proper attributes with no params" do
|
||||
actual = AWS[:ec2].describe_volumes
|
||||
actual.body['requestId'].should be_a(String)
|
||||
volume = actual.body['volumeSet'].select {|volume| volume['volumeId'] == @volume_id}.first
|
||||
volume['availabilityZone'].should be_a(String)
|
||||
volume['createTime'].should be_a(Time)
|
||||
volume['size'].should == 1
|
||||
volume['snapshotId'].should be_nil
|
||||
volume['status'].should be_a(String)
|
||||
volume['volumeId'].should == @volume_id
|
||||
volume['attachmentSet'].should == []
|
||||
end
|
||||
|
||||
it "should return proper attributes for specific volume" do
|
||||
actual = AWS[:ec2].describe_volumes(@volume_id)
|
||||
actual.body['requestId'].should be_a(String)
|
||||
volume = actual.body['volumeSet'].select {|volume| volume['volumeId'] == @volume_id}.first
|
||||
volume['availabilityZone'].should be_a(String)
|
||||
volume['createTime'].should be_a(Time)
|
||||
volume['size'].should == 1
|
||||
volume['snapshotId'].should be_nil
|
||||
volume['status'].should be_a(String)
|
||||
volume['volumeId'].should == @volume_id
|
||||
volume['attachmentSet'].should == []
|
||||
end
|
||||
|
||||
end
|
||||
describe 'failure' do
|
||||
|
||||
it "should raise a BadRequest error if volume does not exist" do
|
||||
lambda {
|
||||
AWS[:ec2].describe_volumes('vol-00000000')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -1,41 +0,0 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.detach_volume' do
|
||||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
@instance_id = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1, {'Placement.AvailabilityZone' => 'us-east-1a'}).body['instancesSet'].first['instanceId']
|
||||
@volume_id = AWS[:ec2].create_volume('us-east-1a', 1).body['volumeId']
|
||||
AWS[:ec2].servers.get(@instance_id).wait_for { ready? }
|
||||
AWS[:ec2].servers.get(@instance_id).wait_for { ready? }
|
||||
AWS[:ec2].attach_volume(@instance_id, @volume_id, '/dev/sdh')
|
||||
AWS[:ec2].volumes.get(@volume_id).wait_for { ready? }
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
AWS[:ec2].volumes.get(@volume_id).wait_for { ready? }
|
||||
AWS[:ec2].delete_volume(@volume_id)
|
||||
AWS[:ec2].terminate_instances([@instance_id])
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = AWS[: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
|
||||
describe 'failure' do
|
||||
|
||||
it "should raise a BadRequest error if the volume does not exist" do
|
||||
lambda {
|
||||
AWS[:ec2].detach_volume('vol-00000000')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -1,36 +0,0 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.disassociate_address' do
|
||||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
@instance_id = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
|
||||
@public_ip = AWS[:ec2].allocate_address.body['publicIp']
|
||||
AWS[:ec2].servers.get(@instance_id).wait_for { ready? }
|
||||
AWS[:ec2].associate_address(@instance_id, @public_ip)
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
AWS[:ec2].release_address(@public_ip)
|
||||
AWS[:ec2].terminate_instances([@instance_id])
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = AWS[:ec2].disassociate_address(@public_ip)
|
||||
actual.body['requestId'].should be_a(String)
|
||||
[false, true].should include(actual.body['return'])
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe 'failure' do
|
||||
|
||||
it "should raise a BadRequest error if the address does not exist" do
|
||||
lambda {
|
||||
AWS[:ec2].disassociate_address('127.0.0.1')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
|
@ -1,26 +0,0 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.release_address' do
|
||||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
@public_ip = AWS[:ec2].allocate_address.body['publicIp']
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = AWS[:ec2].release_address(@public_ip)
|
||||
actual.body['requestId'].should be_a(String)
|
||||
actual.body['return'].should == true
|
||||
end
|
||||
|
||||
end
|
||||
describe 'failure' do
|
||||
|
||||
it "should raise a BadRequest error if address does not exist" do
|
||||
lambda {
|
||||
AWS[:ec2].release_address('127.0.0.1')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
Loading…
Add table
Reference in a new issue