mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
use explicit connection creation from spec_helper in ec2 and simpledb
This commit is contained in:
parent
c53627d712
commit
cfb63f2aea
37 changed files with 186 additions and 122 deletions
|
@ -2,12 +2,16 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
|
||||
describe 'EC2.allocate_address' do
|
||||
|
||||
before(:all) do
|
||||
@ec2 = Fog::AWS::EC2.gen
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
ec2.release_address(@public_ip)
|
||||
@ec2.release_address(@public_ip)
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = ec2.allocate_address
|
||||
actual = @ec2.allocate_address
|
||||
actual.body['requestId'].should be_a(String)
|
||||
@public_ip = actual.body['publicIp']
|
||||
actual.body['publicIp'].should be_a(String)
|
||||
|
|
|
@ -3,17 +3,18 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
describe 'EC2.associate_address' do
|
||||
|
||||
before(:all) do
|
||||
@instance_id = ec2.run_instances('ami-5ee70037', 1, 1).body['instancesSet'].first['instanceId']
|
||||
@public_ip = ec2.allocate_address.body['publicIp']
|
||||
@ec2 = Fog::AWS::EC2.gen
|
||||
@instance_id = @ec2.run_instances('ami-5ee70037', 1, 1).body['instancesSet'].first['instanceId']
|
||||
@public_ip = @ec2.allocate_address.body['publicIp']
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
ec2.release_address(@public_ip)
|
||||
ec2.terminate_instances([@instance_id])
|
||||
@ec2.release_address(@public_ip)
|
||||
@ec2.terminate_instances([@instance_id])
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = ec2.associate_address(@instance_id, @public_ip)
|
||||
actual = @ec2.associate_address(@instance_id, @public_ip)
|
||||
actual.body['requestId'].should be_a(String)
|
||||
[false, true].should include(actual.body['return'])
|
||||
end
|
||||
|
|
|
@ -3,23 +3,24 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
describe 'EC2.attach_volume' do
|
||||
|
||||
before(:all) do
|
||||
@instance_id = ec2.run_instances('ami-5ee70037', 1, 1, {'Placement.AvailabilityZone' => 'us-east-1a'}).body['instancesSet'].first['instanceId']
|
||||
@volume_id = ec2.create_volume('us-east-1a', 1).body['volumeId']
|
||||
@ec2 = Fog::AWS::EC2.gen
|
||||
@instance_id = @ec2.run_instances('ami-5ee70037', 1, 1, {'Placement.AvailabilityZone' => 'us-east-1a'}).body['instancesSet'].first['instanceId']
|
||||
@volume_id = @ec2.create_volume('us-east-1a', 1).body['volumeId']
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
eventually do
|
||||
ec2.detach_volume(@volume_id)
|
||||
@ec2.detach_volume(@volume_id)
|
||||
end
|
||||
eventually do
|
||||
ec2.delete_volume(@volume_id)
|
||||
ec2.terminate_instances([@instance_id])
|
||||
@ec2.delete_volume(@volume_id)
|
||||
@ec2.terminate_instances([@instance_id])
|
||||
end
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
eventually(128) do
|
||||
actual = ec2.attach_volume(@volume_id, @instance_id, '/dev/sdh')
|
||||
actual = @ec2.attach_volume(@volume_id, @instance_id, '/dev/sdh')
|
||||
actual.body['attachTime'].should be_a(Time)
|
||||
actual.body['device'].should be_a(String)
|
||||
actual.body['instanceId'].should be_a(String)
|
||||
|
|
|
@ -3,15 +3,16 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
describe 'EC2.authorize_security_group_ingress' do
|
||||
|
||||
before(:all) do
|
||||
ec2.create_security_group('fog_security_group', 'a security group for testing fog')
|
||||
@ec2 = Fog::AWS::EC2.gen
|
||||
@ec2.create_security_group('fog_security_group', 'a security group for testing fog')
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
ec2.delete_security_group('fog_security_group')
|
||||
@ec2.delete_security_group('fog_security_group')
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = ec2.authorize_security_group_ingress({
|
||||
actual = @ec2.authorize_security_group_ingress({
|
||||
'FromPort' => 80,
|
||||
'GroupName' => 'fog_security_group',
|
||||
'IpProtocol' => 'tcp',
|
||||
|
|
|
@ -2,12 +2,16 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
|
||||
describe 'EC2.create_key_pair' do
|
||||
|
||||
before(:all) do
|
||||
@ec2 = Fog::AWS::EC2.gen
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
ec2.delete_key_pair('fog_key_pair')
|
||||
@ec2.delete_key_pair('fog_key_pair')
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = ec2.create_key_pair('fog_key_pair')
|
||||
actual = @ec2.create_key_pair('fog_key_pair')
|
||||
actual.body['keyFingerprint'].should be_a(String)
|
||||
actual.body['keyMaterial'].should be_a(String)
|
||||
actual.body['keyName'].should be_a(String)
|
||||
|
|
|
@ -2,12 +2,16 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
|
||||
describe 'EC2.create_security_group' do
|
||||
|
||||
before(:all) do
|
||||
@ec2 = Fog::AWS::EC2.gen
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
ec2.delete_security_group('fog_security_group')
|
||||
@ec2.delete_security_group('fog_security_group')
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = ec2.create_security_group('fog_security_group', 'a security group for testing fog')
|
||||
actual = @ec2.create_security_group('fog_security_group', 'a security group for testing fog')
|
||||
actual.body['requestId'].should be_a(String)
|
||||
[false, true].should include(actual.body['return'])
|
||||
end
|
||||
|
|
|
@ -3,18 +3,19 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
describe 'EC2.create_snapshot' do
|
||||
|
||||
before(:all) do
|
||||
@volume_id = ec2.create_volume('us-east-1a', 1).body['volumeId']
|
||||
@ec2 = Fog::AWS::EC2.gen
|
||||
@volume_id = @ec2.create_volume('us-east-1a', 1).body['volumeId']
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
ec2.delete_volume(@volume_id)
|
||||
@ec2.delete_volume(@volume_id)
|
||||
eventually do
|
||||
ec2.delete_snapshot(@snapshot_id)
|
||||
@ec2.delete_snapshot(@snapshot_id)
|
||||
end
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = ec2.create_snapshot(@volume_id)
|
||||
actual = @ec2.create_snapshot(@volume_id)
|
||||
actual.body['progress'].should be_a(String)
|
||||
@snapshot_id = actual.body['snapshotId']
|
||||
actual.body['snapshotId'].should be_a(String)
|
||||
|
|
|
@ -2,12 +2,16 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
|
||||
describe 'EC2.create_volume' do
|
||||
|
||||
before(:all) do
|
||||
@ec2 = Fog::AWS::EC2.gen
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
ec2.delete_volume(@volume_id)
|
||||
@ec2.delete_volume(@volume_id)
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = ec2.create_volume('us-east-1a', 1)
|
||||
actual = @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)
|
||||
|
|
|
@ -3,11 +3,12 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
describe 'EC2.delete_key_pair' do
|
||||
|
||||
before(:all) do
|
||||
ec2.create_key_pair('fog_key_pair')
|
||||
@ec2 = Fog::AWS::EC2.gen
|
||||
@ec2.create_key_pair('fog_key_pair')
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = ec2.delete_key_pair('fog_key_pair')
|
||||
actual = @ec2.delete_key_pair('fog_key_pair')
|
||||
actual.body['requestId'].should be_a(String)
|
||||
[false, true].should include(actual.body['return'])
|
||||
end
|
||||
|
|
|
@ -3,11 +3,12 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
describe 'EC2.delete_security_group' do
|
||||
|
||||
before(:all) do
|
||||
ec2.create_security_group('fog_security_group', 'a security group for testing fog')
|
||||
@ec2 = Fog::AWS::EC2.gen
|
||||
@ec2.create_security_group('fog_security_group', 'a security group for testing fog')
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = ec2.delete_security_group('fog_security_group')
|
||||
actual = @ec2.delete_security_group('fog_security_group')
|
||||
actual.body['requestId'].should be_a(String)
|
||||
[false, true].should include(actual.body['return'])
|
||||
end
|
||||
|
|
|
@ -3,17 +3,18 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
describe 'EC2.delete_snapshot' do
|
||||
|
||||
before(:all) do
|
||||
@volume_id = ec2.create_volume('us-east-1a', 1).body['volumeId']
|
||||
@snapshot_id = ec2.create_snapshot(@volume_id).body['snapshotId']
|
||||
@ec2 = Fog::AWS::EC2.gen
|
||||
@volume_id = @ec2.create_volume('us-east-1a', 1).body['volumeId']
|
||||
@snapshot_id = @ec2.create_snapshot(@volume_id).body['snapshotId']
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
ec2.delete_volume(@volume_id)
|
||||
@ec2.delete_volume(@volume_id)
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
eventually do
|
||||
actual = ec2.delete_snapshot(@snapshot_id)
|
||||
actual = @ec2.delete_snapshot(@snapshot_id)
|
||||
unless actual.body.empty?
|
||||
actual.body['requestId'].should be_a(String)
|
||||
[false, true].should include(actual.body['return'])
|
||||
|
|
|
@ -3,11 +3,12 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
describe 'EC2.create_volume' do
|
||||
|
||||
before(:all) do
|
||||
@volume_id = ec2.create_volume('us-east-1a', 1).body['volumeId']
|
||||
@ec2 = Fog::AWS::EC2.gen
|
||||
@volume_id = @ec2.create_volume('us-east-1a', 1).body['volumeId']
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = ec2.delete_volume(@volume_id)
|
||||
actual = @ec2.delete_volume(@volume_id)
|
||||
actual.body['requestId'].should be_a(String)
|
||||
actual.body['return'].should == true
|
||||
end
|
||||
|
|
|
@ -3,22 +3,23 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
describe 'EC2.describe_addresses' do
|
||||
|
||||
before(:all) do
|
||||
@public_ip = ec2.allocate_address.body['publicIp']
|
||||
@ec2 = Fog::AWS::EC2.gen
|
||||
@public_ip = @ec2.allocate_address.body['publicIp']
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
ec2.release_address(@public_ip)
|
||||
@ec2.release_address(@public_ip)
|
||||
end
|
||||
|
||||
it "should return proper attributes with no params" do
|
||||
actual = ec2.describe_addresses
|
||||
actual = @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 = ec2.describe_addresses(@public_ip)
|
||||
actual = @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
|
||||
|
|
|
@ -2,8 +2,12 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
|
||||
describe 'EC2.describe_availability_zones' do
|
||||
|
||||
before(:all) do
|
||||
@ec2 = Fog::AWS::EC2.gen
|
||||
end
|
||||
|
||||
it "should return proper attributes with no params" do
|
||||
actual = ec2.describe_availability_zones
|
||||
actual = @ec2.describe_availability_zones
|
||||
zone = actual.body['availabilityZoneInfo'].first
|
||||
zone['regionName'].should be_a(String)
|
||||
zone['zoneName'].should be_a(String)
|
||||
|
@ -11,7 +15,7 @@ describe 'EC2.describe_availability_zones' do
|
|||
end
|
||||
|
||||
it "should return proper attribute with params" do
|
||||
actual = ec2.describe_availability_zones(['us-east-1a'])
|
||||
actual = @ec2.describe_availability_zones(['us-east-1a'])
|
||||
zone = actual.body['availabilityZoneInfo'].first
|
||||
zone['regionName'].should be_a(String)
|
||||
zone['zoneName'].should be_a(String)
|
||||
|
|
|
@ -2,8 +2,12 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
|
||||
describe 'EC2.describe_images' do
|
||||
|
||||
before(:all) do
|
||||
@ec2 = Fog::AWS::EC2.gen
|
||||
end
|
||||
|
||||
it "should return proper attributes with no params" do
|
||||
actual = ec2.describe_images
|
||||
actual = @ec2.describe_images
|
||||
actual.body['requestId'].should be_a(String)
|
||||
image = actual.body['imagesSet'].first
|
||||
image['architecture'].should be_a(String)
|
||||
|
@ -19,7 +23,7 @@ describe 'EC2.describe_images' do
|
|||
end
|
||||
|
||||
it "should return proper attributes with params" do
|
||||
actual = ec2.describe_images('ImageId' => 'ami-5ee70037')
|
||||
actual = @ec2.describe_images('ImageId' => 'ami-5ee70037')
|
||||
actual.body['requestId'].should be_a(String)
|
||||
image = actual.body['imagesSet'].first
|
||||
image['architecture'].should be_a(String)
|
||||
|
|
|
@ -3,17 +3,18 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
describe 'EC2.describe_instances' do
|
||||
|
||||
before(:all) do
|
||||
run_instances = ec2.run_instances('ami-5ee70037', 1, 1).body
|
||||
@ec2 = Fog::AWS::EC2.gen
|
||||
run_instances = @ec2.run_instances('ami-5ee70037', 1, 1).body
|
||||
@instance_id = run_instances['instancesSet'].first['instanceId']
|
||||
@reservation_id = run_instances['reservationId']
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
ec2.terminate_instances([@instance_id])
|
||||
@ec2.terminate_instances([@instance_id])
|
||||
end
|
||||
|
||||
it "should return proper attributes with no params" do
|
||||
actual = ec2.describe_instances
|
||||
actual = @ec2.describe_instances
|
||||
reservation = actual.body['reservationSet'].select {|reservation| reservation['reservationId'] == @reservation_id}.first
|
||||
reservation['groupSet'].should be_an(Array)
|
||||
reservation['groupSet'].first.should be_a(String)
|
||||
|
@ -43,7 +44,7 @@ describe 'EC2.describe_instances' do
|
|||
end
|
||||
|
||||
it "should return proper attributes with params" do
|
||||
actual = ec2.describe_instances(@instance_id)
|
||||
actual = @ec2.describe_instances(@instance_id)
|
||||
reservation = actual.body['reservationSet'].select {|reservation| reservation['reservationId'] == @reservation_id}.first
|
||||
reservation['groupSet'].should be_an(Array)
|
||||
reservation['groupSet'].first.should be_a(String)
|
||||
|
|
|
@ -3,15 +3,16 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
describe 'EC2.describe_key_pairs' do
|
||||
|
||||
before(:all) do
|
||||
ec2.create_key_pair('key_name')
|
||||
@ec2 = Fog::AWS::EC2.gen
|
||||
@ec2.create_key_pair('key_name')
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
ec2.delete_key_pair('key_name')
|
||||
@ec2.delete_key_pair('key_name')
|
||||
end
|
||||
|
||||
it "should return proper attributes with no params" do
|
||||
actual = ec2.describe_key_pairs
|
||||
actual = @ec2.describe_key_pairs
|
||||
actual.body['keySet'].should be_an(Array)
|
||||
actual.body['requestId'].should be_a(String)
|
||||
key_pair = actual.body['keySet'].select {|key| key['keyName'] == 'key_name' }.first
|
||||
|
@ -20,7 +21,7 @@ describe 'EC2.describe_key_pairs' do
|
|||
end
|
||||
|
||||
it "should return proper attributes with params" do
|
||||
actual = ec2.describe_key_pairs(['key_name'])
|
||||
actual = @ec2.describe_key_pairs(['key_name'])
|
||||
actual.body['keySet'].should be_an(Array)
|
||||
actual.body['requestId'].should be_a(String)
|
||||
key_pair = actual.body['keySet'].select {|key| key['keyName'] == 'key_name' }.first
|
||||
|
|
|
@ -2,15 +2,19 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
|
||||
describe 'EC2.describe_availability_zones' do
|
||||
|
||||
before(:all) do
|
||||
@ec2 = Fog::AWS::EC2.gen
|
||||
end
|
||||
|
||||
it "should return proper attributes with no params" do
|
||||
actual = ec2.describe_regions
|
||||
actual = @ec2.describe_regions
|
||||
zone = actual.body['regionInfo'].first
|
||||
zone['regionEndpoint'].should be_a(String)
|
||||
zone['regionName'].should be_a(String)
|
||||
end
|
||||
|
||||
it "should return proper attribute with params" do
|
||||
actual = ec2.describe_regions(['us-east-1'])
|
||||
actual = @ec2.describe_regions(['us-east-1'])
|
||||
zone = actual.body['regionInfo'].first
|
||||
zone['regionEndpoint'].should be_a(String)
|
||||
zone['regionName'].should be_a(String)
|
||||
|
|
|
@ -2,8 +2,12 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
|
||||
describe 'EC2.describe_security_groups' do
|
||||
|
||||
before(:all) do
|
||||
@ec2 = Fog::AWS::EC2.gen
|
||||
end
|
||||
|
||||
it "should return proper attributes with no params" do
|
||||
actual = ec2.describe_security_groups
|
||||
actual = @ec2.describe_security_groups
|
||||
actual.body['requestId'].should be_a(String)
|
||||
actual.body['securityGroupInfo'].should be_an(Array)
|
||||
security_group = actual.body['securityGroupInfo'].select do |security_group|
|
||||
|
@ -25,7 +29,7 @@ describe 'EC2.describe_security_groups' do
|
|||
end
|
||||
|
||||
it "should return proper attributes with params" do
|
||||
actual = ec2.describe_security_groups('default')
|
||||
actual = @ec2.describe_security_groups('default')
|
||||
actual.body['requestId'].should be_a(String)
|
||||
actual.body['securityGroupInfo'].should be_an(Array)
|
||||
security_group = actual.body['securityGroupInfo'].select do |security_group|
|
||||
|
|
|
@ -3,20 +3,21 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
describe 'EC2.describe_snapshots' do
|
||||
|
||||
before(:all) do
|
||||
@volume_id = ec2.create_volume('us-east-1a', 1).body['volumeId']
|
||||
@snapshot_id = ec2.create_snapshot(@volume_id).body['snapshotId']
|
||||
@ec2 = Fog::AWS::EC2.gen
|
||||
@volume_id = @ec2.create_volume('us-east-1a', 1).body['volumeId']
|
||||
@snapshot_id = @ec2.create_snapshot(@volume_id).body['snapshotId']
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
ec2.delete_volume(@volume_id)
|
||||
@ec2.delete_volume(@volume_id)
|
||||
eventually do
|
||||
ec2.delete_snapshot(@snapshot_id)
|
||||
@ec2.delete_snapshot(@snapshot_id)
|
||||
end
|
||||
end
|
||||
|
||||
it "should return proper attributes with no params" do
|
||||
eventually do
|
||||
actual = ec2.describe_snapshots
|
||||
actual = @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)
|
||||
|
@ -29,7 +30,7 @@ describe 'EC2.describe_snapshots' do
|
|||
|
||||
it "should return proper attributes with params" do
|
||||
eventually do
|
||||
actual = ec2.describe_snapshots([@snapshot_id])
|
||||
actual = @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)
|
||||
|
|
|
@ -3,15 +3,16 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
describe 'EC2.describe_volumes' do
|
||||
|
||||
before(:all) do
|
||||
@volume_id = ec2.create_volume('us-east-1a', 1).body['volumeId']
|
||||
@ec2 = Fog::AWS::EC2.gen
|
||||
@volume_id = @ec2.create_volume('us-east-1a', 1).body['volumeId']
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
ec2.delete_volume(@volume_id)
|
||||
@ec2.delete_volume(@volume_id)
|
||||
end
|
||||
|
||||
it "should return proper attributes with no params" do
|
||||
actual = ec2.describe_volumes
|
||||
actual = @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)
|
||||
|
@ -24,7 +25,7 @@ describe 'EC2.describe_volumes' do
|
|||
end
|
||||
|
||||
it "should return proper attributes for specific volume" do
|
||||
actual = ec2.describe_volumes(@volume_id)
|
||||
actual = @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)
|
||||
|
|
|
@ -3,23 +3,24 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
describe 'EC2.detach_volume' do
|
||||
|
||||
before(:all) do
|
||||
@instance_id = ec2.run_instances('ami-5ee70037', 1, 1, {'Placement.AvailabilityZone' => 'us-east-1a'}).body['instancesSet'].first['instanceId']
|
||||
@volume_id = ec2.create_volume('us-east-1a', 1).body['volumeId']
|
||||
@ec2 = Fog::AWS::EC2.gen
|
||||
@instance_id = @ec2.run_instances('ami-5ee70037', 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(@volume_id, @instance_id, '/dev/sdh')
|
||||
@ec2.attach_volume(@volume_id, @instance_id, '/dev/sdh')
|
||||
end
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
eventually do
|
||||
ec2.delete_volume(@volume_id)
|
||||
ec2.terminate_instances([@instance_id])
|
||||
@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 = @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)
|
||||
|
|
|
@ -3,18 +3,19 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
describe 'EC2.disassociate_address' do
|
||||
|
||||
before(:all) do
|
||||
@instance_id = ec2.run_instances('ami-5ee70037', 1, 1).body['instancesSet'].first['instanceId']
|
||||
@public_ip = ec2.allocate_address.body['publicIp']
|
||||
ec2.associate_address(@instance_id, @public_ip)
|
||||
@ec2 = Fog::AWS::EC2.gen
|
||||
@instance_id = @ec2.run_instances('ami-5ee70037', 1, 1).body['instancesSet'].first['instanceId']
|
||||
@public_ip = @ec2.allocate_address.body['publicIp']
|
||||
@ec2.associate_address(@instance_id, @public_ip)
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
ec2.release_address(@public_ip)
|
||||
ec2.terminate_instances([@instance_id])
|
||||
@ec2.release_address(@public_ip)
|
||||
@ec2.terminate_instances([@instance_id])
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = ec2.disassociate_address(@public_ip)
|
||||
actual = @ec2.disassociate_address(@public_ip)
|
||||
actual.body['requestId'].should be_a(String)
|
||||
[false, true].should include(actual.body['return'])
|
||||
end
|
||||
|
|
|
@ -3,15 +3,16 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
describe 'EC2.get_console_output' do
|
||||
|
||||
before(:all) do
|
||||
@instance_id = ec2.run_instances('ami-5ee70037', 1, 1).body['instancesSet'].first['instanceId']
|
||||
@ec2 = Fog::AWS::EC2.gen
|
||||
@instance_id = @ec2.run_instances('ami-5ee70037', 1, 1).body['instancesSet'].first['instanceId']
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
ec2.terminate_instances([@instance_id])
|
||||
@ec2.terminate_instances([@instance_id])
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = ec2.get_console_output(@instance_id)
|
||||
actual = @ec2.get_console_output(@instance_id)
|
||||
actual.body['instanceId'].should be_a(String)
|
||||
actual.body['output'].should be_a(String)
|
||||
actual.body['requestId'].should be_a(String)
|
||||
|
|
|
@ -3,15 +3,16 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
describe 'EC2.reboot_instances' do
|
||||
|
||||
before(:all) do
|
||||
@instance_id = ec2.run_instances('ami-5ee70037', 1, 1).body['instancesSet'].first['instanceId']
|
||||
@ec2 = Fog::AWS::EC2.gen
|
||||
@instance_id = @ec2.run_instances('ami-5ee70037', 1, 1).body['instancesSet'].first['instanceId']
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
ec2.terminate_instances([@instance_id])
|
||||
@ec2.terminate_instances([@instance_id])
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = ec2.reboot_instances([@instance_id])
|
||||
actual = @ec2.reboot_instances([@instance_id])
|
||||
actual.body['requestId'].should be_a(String)
|
||||
[false, true].should include(actual.body['return'])
|
||||
end
|
||||
|
|
|
@ -3,11 +3,12 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
describe 'EC2.release_address' do
|
||||
|
||||
before(:all) do
|
||||
@public_ip = ec2.allocate_address.body['publicIp']
|
||||
@ec2 = Fog::AWS::EC2.gen
|
||||
@public_ip = @ec2.allocate_address.body['publicIp']
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = ec2.release_address(@public_ip)
|
||||
actual = @ec2.release_address(@public_ip)
|
||||
actual.body['requestId'].should be_a(String)
|
||||
actual.body['return'].should == true
|
||||
end
|
||||
|
|
|
@ -3,8 +3,9 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
describe 'EC2.revoke_security_group_ingress' do
|
||||
|
||||
before(:all) do
|
||||
ec2.create_security_group('fog_security_group', 'a security group for testing fog')
|
||||
ec2.authorize_security_group_ingress({
|
||||
@ec2 = Fog::AWS::EC2.gen
|
||||
@ec2.create_security_group('fog_security_group', 'a security group for testing fog')
|
||||
@ec2.authorize_security_group_ingress({
|
||||
'FromPort' => 80,
|
||||
'GroupName' => 'fog_security_group',
|
||||
'IpProtocol' => 'tcp',
|
||||
|
@ -13,11 +14,11 @@ describe 'EC2.revoke_security_group_ingress' do
|
|||
end
|
||||
|
||||
after(:all) do
|
||||
ec2.delete_security_group('fog_security_group')
|
||||
@ec2.delete_security_group('fog_security_group')
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = ec2.revoke_security_group_ingress({
|
||||
actual = @ec2.revoke_security_group_ingress({
|
||||
'FromPort' => 80,
|
||||
'GroupName' => 'fog_security_group',
|
||||
'IpProtocol' => 'tcp',
|
||||
|
|
|
@ -2,12 +2,16 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
|
||||
describe 'EC2.run_instances' do
|
||||
|
||||
before(:all) do
|
||||
@ec2 = Fog::AWS::EC2.gen
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
ec2.terminate_instances([@instance_id])
|
||||
@ec2.terminate_instances([@instance_id])
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = ec2.run_instances('ami-5ee70037', 1, 1)
|
||||
actual = @ec2.run_instances('ami-5ee70037', 1, 1)
|
||||
@instance_id = actual.body['instancesSet'].first['instanceId']
|
||||
actual.body['groupSet'].should be_an(Array)
|
||||
actual.body['groupSet'].first.should be_a(String)
|
||||
|
|
|
@ -3,11 +3,12 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
describe 'EC2.terminate_instances' do
|
||||
|
||||
before(:all) do
|
||||
@instance_id = ec2.run_instances('ami-5ee70037', 1, 1).body['instancesSet'].first['instanceId']
|
||||
@ec2 = Fog::AWS::EC2.gen
|
||||
@instance_id = @ec2.run_instances('ami-5ee70037', 1, 1).body['instancesSet'].first['instanceId']
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = ec2.terminate_instances([@instance_id])
|
||||
actual = @ec2.terminate_instances([@instance_id])
|
||||
actual.body['requestId'].should be_a(String)
|
||||
actual.body['instancesSet'].should be_an(Array)
|
||||
instance = actual.body['instancesSet'].select {|instance| instance['instanceId'] == @instance_id}.first
|
||||
|
|
|
@ -3,16 +3,17 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
describe 'SimpleDB.batch_put_attributes' do
|
||||
|
||||
before(:all) do
|
||||
@sdb = Fog::AWS::SimpleDB.gen
|
||||
@domain_name = "fog_domain_#{Time.now.to_i}"
|
||||
sdb.create_domain(@domain_name)
|
||||
@sdb.create_domain(@domain_name)
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
sdb.delete_domain(@domain_name)
|
||||
@sdb.delete_domain(@domain_name)
|
||||
end
|
||||
|
||||
it 'should return proper attributes' do
|
||||
actual = sdb.batch_put_attributes(@domain_name, { 'a' => { 'b' => 'c' }, 'x' => { 'y' => 'z' } })
|
||||
actual = @sdb.batch_put_attributes(@domain_name, { 'a' => { 'b' => 'c' }, 'x' => { 'y' => 'z' } })
|
||||
actual.body['RequestId'].should be_a(String)
|
||||
actual.body['BoxUsage'].should be_a(Float)
|
||||
end
|
||||
|
|
|
@ -3,15 +3,16 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
describe 'SimpleDB.create_domain' do
|
||||
|
||||
before(:all) do
|
||||
@sdb = Fog::AWS::SimpleDB.gen
|
||||
@domain_name = "fog_domain_#{Time.now.to_i}"
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
sdb.delete_domain(@domain_name)
|
||||
@sdb.delete_domain(@domain_name)
|
||||
end
|
||||
|
||||
it 'should return proper attributes' do
|
||||
actual = sdb.create_domain(@domain_name)
|
||||
actual = @sdb.create_domain(@domain_name)
|
||||
actual.body['RequestId'].should be_a(String)
|
||||
actual.body['BoxUsage'].should be_a(Float)
|
||||
end
|
||||
|
|
|
@ -3,16 +3,17 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
describe 'SimpleDB.delete_attributes' do
|
||||
|
||||
before(:all) do
|
||||
sdb.create_domain('delete_attributes')
|
||||
sdb.put_attributes('delete_attributes', 'foo', { :bar => :baz })
|
||||
@sdb = Fog::AWS::SimpleDB.gen
|
||||
@sdb.create_domain('delete_attributes')
|
||||
@sdb.put_attributes('delete_attributes', 'foo', { :bar => :baz })
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
sdb.delete_domain('delete_attributes')
|
||||
@sdb.delete_domain('delete_attributes')
|
||||
end
|
||||
|
||||
it 'should return proper attributes from delete_attributes' do
|
||||
actual = sdb.delete_attributes('delete_attributes', 'foo')
|
||||
actual = @sdb.delete_attributes('delete_attributes', 'foo')
|
||||
actual.body['RequestId'].should be_a(String)
|
||||
actual.body['BoxUsage'].should be_a(Float)
|
||||
end
|
||||
|
|
|
@ -3,15 +3,16 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
describe 'SimpleDB.delete_domain' do
|
||||
|
||||
before(:all) do
|
||||
@sdb = Fog::AWS::SimpleDB.gen
|
||||
@domain_name = "fog_domain_#{Time.now.to_i}"
|
||||
end
|
||||
|
||||
before(:all) do
|
||||
sdb.create_domain(@domain_name)
|
||||
@sdb.create_domain(@domain_name)
|
||||
end
|
||||
|
||||
it 'should return proper attributes' do
|
||||
actual = sdb.delete_domain(@domain_name)
|
||||
actual = @sdb.delete_domain(@domain_name)
|
||||
actual.body['RequestId'].should be_a(String)
|
||||
actual.body['BoxUsage'].should be_a(Float)
|
||||
end
|
||||
|
|
|
@ -3,16 +3,17 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
describe 'SimpleDB.domain_metadata' do
|
||||
|
||||
before(:all) do
|
||||
@sdb = Fog::AWS::SimpleDB.gen
|
||||
@domain_name = "fog_domain_#{Time.now.to_i}"
|
||||
sdb.create_domain(@domain_name)
|
||||
@sdb.create_domain(@domain_name)
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
sdb.delete_domain(@domain_name)
|
||||
@sdb.delete_domain(@domain_name)
|
||||
end
|
||||
|
||||
it 'should return proper attributes when there are no items' do
|
||||
results = sdb.domain_metadata(@domain_name)
|
||||
results = @sdb.domain_metadata(@domain_name)
|
||||
results.body['AttributeNameCount'].should == 0
|
||||
results.body['AttributeNamesSizeBytes'].should == 0
|
||||
results.body['AttributeValueCount'].should == 0
|
||||
|
@ -25,8 +26,8 @@ describe 'SimpleDB.domain_metadata' do
|
|||
end
|
||||
|
||||
it 'should return proper attributes with items' do
|
||||
sdb.put_attributes(@domain_name, 'foo', { :bar => :baz })
|
||||
results = sdb.domain_metadata(@domain_name)
|
||||
@sdb.put_attributes(@domain_name, 'foo', { :bar => :baz })
|
||||
results = @sdb.domain_metadata(@domain_name)
|
||||
results.body['AttributeNameCount'].should == 1
|
||||
results.body['AttributeNamesSizeBytes'].should == 3
|
||||
results.body['AttributeValueCount'].should == 1
|
||||
|
|
|
@ -3,25 +3,26 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
describe 'SimpleDB.get_attributes' do
|
||||
|
||||
before(:all) do
|
||||
@sdb = Fog::AWS::SimpleDB.gen
|
||||
@domain_name = "fog_domain_#{Time.now.to_i}"
|
||||
sdb.create_domain(@domain_name)
|
||||
@sdb.create_domain(@domain_name)
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
sdb.delete_domain(@domain_name)
|
||||
@sdb.delete_domain(@domain_name)
|
||||
end
|
||||
|
||||
it 'should have no attributes for foo before put_attributes' do
|
||||
eventually do
|
||||
actual = sdb.get_attributes(@domain_name, 'foo')
|
||||
actual = @sdb.get_attributes(@domain_name, 'foo')
|
||||
actual.body['Attributes'].should be_empty
|
||||
end
|
||||
end
|
||||
|
||||
it 'should have attributes for foo after put_attributes' do
|
||||
sdb.put_attributes(@domain_name, 'foo', { :bar => :baz })
|
||||
@sdb.put_attributes(@domain_name, 'foo', { :bar => :baz })
|
||||
eventually do
|
||||
actual = sdb.get_attributes(@domain_name, 'foo')
|
||||
actual = @sdb.get_attributes(@domain_name, 'foo')
|
||||
actual.body['Attributes'].should == { 'bar' => ['baz'] }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,24 +3,25 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
describe 'SimpleDB.list_domains' do
|
||||
|
||||
before(:all) do
|
||||
@sdb = Fog::AWS::SimpleDB.gen
|
||||
@domain_name = "fog_domain_#{Time.now.to_i}"
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
sdb.delete_domain(@domain_name)
|
||||
@sdb.delete_domain(@domain_name)
|
||||
end
|
||||
|
||||
it 'should return proper attributes' do
|
||||
results = sdb.list_domains
|
||||
results = @sdb.list_domains
|
||||
results.body['BoxUsage'].should be_a(Float)
|
||||
results.body['Domains'].should be_an(Array)
|
||||
results.body['RequestId'].should be_a(String)
|
||||
end
|
||||
|
||||
it 'should include created domains' do
|
||||
sdb.create_domain(@domain_name)
|
||||
@sdb.create_domain(@domain_name)
|
||||
eventually do
|
||||
actual = sdb.list_domains
|
||||
actual = @sdb.list_domains
|
||||
actual.body['Domains'].should include(@domain_name)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,16 +3,17 @@ require File.dirname(__FILE__) + '/../../spec_helper'
|
|||
describe 'SimpleDB.put_attributes' do
|
||||
|
||||
before(:all) do
|
||||
@sdb = Fog::AWS::SimpleDB.gen
|
||||
@domain_name = "fog_domain_#{Time.now.to_i}"
|
||||
sdb.create_domain(@domain_name)
|
||||
@sdb.create_domain(@domain_name)
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
sdb.delete_domain(@domain_name)
|
||||
@sdb.delete_domain(@domain_name)
|
||||
end
|
||||
|
||||
it 'should return proper attributes from put_attributes' do
|
||||
actual = sdb.put_attributes(@domain_name, 'foo', { 'bar' => 'baz' })
|
||||
actual = @sdb.put_attributes(@domain_name, 'foo', { 'bar' => 'baz' })
|
||||
actual.body['RequestId'].should be_a(String)
|
||||
actual.body['BoxUsage'].should be_a(Float)
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue