fog 0.0.91 → 0.0.92
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/Gemfile.lock +39 -39
- data/fog.gemspec +17 -16
- data/lib/fog.rb +1 -1
- data/lib/fog/aws/elb.rb +4 -0
- data/lib/fog/aws/models/ec2/snapshot.rb +3 -0
- data/lib/fog/aws/parsers/ec2/create_snapshot.rb +5 -1
- data/lib/fog/aws/parsers/ec2/describe_snapshots.rb +5 -1
- data/lib/fog/aws/parsers/elb/create_load_balancer.rb +26 -0
- data/lib/fog/aws/parsers/elb/delete_load_balancer.rb +24 -0
- data/lib/fog/aws/parsers/s3/access_control_list.rb +46 -0
- data/lib/fog/aws/requests/ec2/create_snapshot.rb +11 -7
- data/lib/fog/aws/requests/ec2/describe_snapshots.rb +3 -0
- data/lib/fog/aws/requests/ec2/revoke_security_group_ingress.rb +0 -1
- data/lib/fog/aws/requests/ec2/run_instances.rb +0 -2
- data/lib/fog/aws/requests/ec2/terminate_instances.rb +0 -1
- data/lib/fog/aws/requests/elb/create_load_balancer.rb +57 -0
- data/lib/fog/aws/requests/elb/delete_load_balancer.rb +40 -0
- data/lib/fog/aws/requests/s3/copy_object.rb +0 -1
- data/lib/fog/aws/requests/s3/get_bucket.rb +2 -3
- data/lib/fog/aws/requests/s3/get_bucket_acl.rb +53 -0
- data/lib/fog/aws/requests/s3/get_object.rb +1 -31
- data/lib/fog/aws/requests/s3/get_object_acl.rb +58 -0
- data/lib/fog/aws/requests/s3/get_object_torrent.rb +55 -0
- data/lib/fog/aws/requests/s3/get_object_url.rb +54 -0
- data/lib/fog/aws/requests/s3/put_bucket_acl.rb +80 -0
- data/lib/fog/aws/s3.rb +8 -2
- data/lib/fog/collection.rb +1 -1
- data/lib/fog/connection.rb +7 -5
- data/lib/fog/model.rb +5 -2
- data/lib/fog/rackspace/files.rb +2 -2
- data/lib/fog/rackspace/requests/files/get_object.rb +1 -1
- data/lib/fog/terremark/parsers/shared/get_internet_services.rb +2 -2
- data/lib/fog/terremark/parsers/shared/get_node_services.rb +3 -0
- data/lib/fog/terremark/parsers/shared/vapp.rb +33 -3
- data/lib/fog/terremark/requests/shared/delete_internet_service.rb +0 -12
- data/lib/fog/terremark/requests/shared/delete_node_service.rb +0 -12
- data/lib/fog/terremark/requests/shared/delete_vapp.rb +0 -12
- data/lib/fog/terremark/shared.rb +0 -1
- data/spec/aws/models/s3/file_spec.rb +2 -2
- data/spec/aws/models/s3/files_spec.rb +2 -2
- data/spec/aws/requests/ec2/get_console_output_spec.rb +4 -4
- data/spec/aws/requests/s3/get_bucket_spec.rb +9 -9
- data/tests/aws/helper.rb +105 -0
- data/tests/aws/requests/ec2/address_tests.rb +88 -0
- data/tests/aws/requests/ec2/snapshot_tests.rb +50 -0
- data/tests/aws/requests/ec2/volume_tests.rb +84 -0
- data/tests/helper.rb +21 -6
- data/tests/helper_tests.rb +38 -7
- data/tests/rackspace/requests/servers/create_image_tests.rb +1 -1
- data/tests/rackspace/requests/servers/create_server_tests.rb +1 -1
- data/tests/rackspace/requests/servers/delete_image_tests.rb +1 -4
- data/tests/rackspace/requests/servers/delete_server_tests.rb +1 -4
- data/tests/rackspace/requests/servers/get_flavor_details_tests.rb +2 -5
- data/tests/rackspace/requests/servers/get_image_details_tests.rb +2 -5
- data/tests/rackspace/requests/servers/get_server_details_tests.rb +2 -5
- data/tests/rackspace/requests/servers/list_addresses_tests.rb +2 -5
- data/tests/rackspace/requests/servers/list_flavors_detail_tests.rb +1 -1
- data/tests/rackspace/requests/servers/list_flavors_tests.rb +1 -1
- data/tests/rackspace/requests/servers/list_images_detail_tests.rb +1 -1
- data/tests/rackspace/requests/servers/list_images_tests.rb +1 -1
- data/tests/rackspace/requests/servers/list_private_addresses_tests.rb +2 -5
- data/tests/rackspace/requests/servers/list_public_addresses_tests.rb +2 -5
- data/tests/rackspace/requests/servers/list_servers_detail_tests.rb +1 -1
- data/tests/rackspace/requests/servers/list_servers_tests.rb +1 -1
- data/tests/rackspace/requests/servers/reboot_server_tests.rb +1 -4
- data/tests/rackspace/requests/servers/update_server_tests.rb +2 -5
- data/tests/slicehost/requests/create_slice_tests.rb +1 -1
- data/tests/slicehost/requests/delete_slice_tests.rb +1 -4
- data/tests/slicehost/requests/get_backups_tests.rb +1 -2
- data/tests/slicehost/requests/get_flavor_tests.rb +2 -5
- data/tests/slicehost/requests/get_flavors_tests.rb +1 -1
- data/tests/slicehost/requests/get_image_tests.rb +2 -5
- data/tests/slicehost/requests/get_images_tests.rb +1 -1
- data/tests/slicehost/requests/get_slice_tests.rb +2 -5
- data/tests/slicehost/requests/get_slices_tests.rb +1 -1
- data/tests/slicehost/requests/reboot_slice_tests.rb +2 -5
- metadata +19 -18
- data/spec/aws/requests/ec2/allocate_address_spec.rb +0 -18
- data/spec/aws/requests/ec2/associate_address_spec.rb +0 -43
- data/spec/aws/requests/ec2/attach_volume_spec.rb +0 -51
- data/spec/aws/requests/ec2/create_snapshot_spec.rb +0 -36
- data/spec/aws/requests/ec2/create_volume_spec.rb +0 -23
- data/spec/aws/requests/ec2/delete_snapshot_spec.rb +0 -34
- data/spec/aws/requests/ec2/delete_volume_spec.rb +0 -26
- data/spec/aws/requests/ec2/describe_addresses_spec.rb +0 -38
- data/spec/aws/requests/ec2/describe_snapshots_spec.rb +0 -50
- data/spec/aws/requests/ec2/describe_volumes_spec.rb +0 -50
- data/spec/aws/requests/ec2/detach_volume_spec.rb +0 -41
- data/spec/aws/requests/ec2/disassociate_address_spec.rb +0 -36
- data/spec/aws/requests/ec2/release_address_spec.rb +0 -26
@@ -1,18 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
-
|
3
|
-
describe 'EC2.allocate_address' do
|
4
|
-
describe 'success' do
|
5
|
-
|
6
|
-
after(:each) do
|
7
|
-
AWS[:ec2].release_address(@public_ip)
|
8
|
-
end
|
9
|
-
|
10
|
-
it "should return proper attributes" do
|
11
|
-
actual = AWS[:ec2].allocate_address
|
12
|
-
actual.body['requestId'].should be_a(String)
|
13
|
-
@public_ip = actual.body['publicIp']
|
14
|
-
actual.body['publicIp'].should be_a(String)
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
18
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
-
|
3
|
-
describe 'EC2.associate_address' do
|
4
|
-
describe 'success' do
|
5
|
-
|
6
|
-
before(:each) do
|
7
|
-
@instance_id = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
|
8
|
-
@public_ip = AWS[:ec2].allocate_address.body['publicIp']
|
9
|
-
AWS[:ec2].servers.get(@instance_id).wait_for { ready? }
|
10
|
-
end
|
11
|
-
|
12
|
-
after(:each) do
|
13
|
-
AWS[:ec2].release_address(@public_ip)
|
14
|
-
AWS[:ec2].terminate_instances(@instance_id)
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should return proper attributes" do
|
18
|
-
actual = AWS[:ec2].associate_address(@instance_id, @public_ip)
|
19
|
-
actual.body['requestId'].should be_a(String)
|
20
|
-
[false, true].should include(actual.body['return'])
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
describe 'failure' do
|
25
|
-
|
26
|
-
it "should raise a BadRequest error if the instance does not exist" do
|
27
|
-
@public_ip = AWS[:ec2].allocate_address.body['publicIp']
|
28
|
-
lambda {
|
29
|
-
AWS[:ec2].associate_address('i-00000000', @public_ip)
|
30
|
-
}.should raise_error(Excon::Errors::BadRequest)
|
31
|
-
AWS[:ec2].release_address(@public_ip)
|
32
|
-
end
|
33
|
-
|
34
|
-
it "should raise a BadRequest error if the address does not exist" do
|
35
|
-
@instance_id = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
|
36
|
-
lambda {
|
37
|
-
AWS[:ec2].associate_address(@instance_id, '127.0.0.1')
|
38
|
-
}.should raise_error(Excon::Errors::BadRequest)
|
39
|
-
AWS[:ec2].terminate_instances(@instance_id)
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
43
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
-
|
3
|
-
describe 'EC2.attach_volume' do
|
4
|
-
describe 'success' do
|
5
|
-
|
6
|
-
before(:each) do
|
7
|
-
@instance_id = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1, {'Placement.AvailabilityZone' => 'us-east-1a'}).body['instancesSet'].first['instanceId']
|
8
|
-
@volume_id = AWS[:ec2].create_volume('us-east-1a', 1).body['volumeId']
|
9
|
-
AWS[:ec2].servers.get(@instance_id).wait_for { ready? }
|
10
|
-
AWS[:ec2].volumes.get(@volume_id).wait_for { ready? }
|
11
|
-
end
|
12
|
-
|
13
|
-
after(:each) do
|
14
|
-
AWS[:ec2].volumes.get(@volume_id).wait_for { state == 'attached' }
|
15
|
-
AWS[:ec2].detach_volume(@volume_id)
|
16
|
-
AWS[:ec2].volumes.get(@volume_id).wait_for { ready? }
|
17
|
-
AWS[:ec2].delete_volume(@volume_id)
|
18
|
-
AWS[:ec2].terminate_instances(@instance_id)
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should return proper attributes" do
|
22
|
-
actual = AWS[:ec2].attach_volume(@instance_id, @volume_id, '/dev/sdh')
|
23
|
-
actual.body['attachTime'].should be_a(Time)
|
24
|
-
actual.body['device'].should be_a(String)
|
25
|
-
actual.body['instanceId'].should be_a(String)
|
26
|
-
actual.body['requestId'].should be_a(String)
|
27
|
-
actual.body['status'].should be_a(String)
|
28
|
-
actual.body['volumeId'].should be_a(String)
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
describe 'failure' do
|
33
|
-
|
34
|
-
it "should raise a BadRequest error if the instance does not exist" do
|
35
|
-
@volume_id = AWS[:ec2].create_volume('us-east-1a', 1).body['volumeId']
|
36
|
-
lambda {
|
37
|
-
AWS[:ec2].attach_volume('i-00000000', @volume_id, '/dev/sdh')
|
38
|
-
}.should raise_error(Excon::Errors::BadRequest)
|
39
|
-
AWS[:ec2].delete_volume(@volume_id)
|
40
|
-
end
|
41
|
-
|
42
|
-
it "should raise a BadRequest error if the address does not exist" do
|
43
|
-
@instance_id = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
|
44
|
-
lambda {
|
45
|
-
AWS[:ec2].attach_volume(@instance_id, 'vol-00000000', '/dev/sdh')
|
46
|
-
}.should raise_error(Excon::Errors::BadRequest)
|
47
|
-
AWS[:ec2].terminate_instances(@instance_id)
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
51
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
-
|
3
|
-
describe 'EC2.create_snapshot' do
|
4
|
-
describe 'success' do
|
5
|
-
|
6
|
-
before(:each) do
|
7
|
-
@volume_id = AWS[:ec2].create_volume('us-east-1a', 1).body['volumeId']
|
8
|
-
end
|
9
|
-
|
10
|
-
after(:each) do
|
11
|
-
AWS[:ec2].delete_volume(@volume_id)
|
12
|
-
AWS[:ec2].snapshots.get(@snapshot_id).wait_for { ready? }
|
13
|
-
AWS[:ec2].delete_snapshot(@snapshot_id)
|
14
|
-
end
|
15
|
-
|
16
|
-
it "should return proper attributes" do
|
17
|
-
actual = AWS[:ec2].create_snapshot(@volume_id)
|
18
|
-
actual.body['progress'].should be_nil
|
19
|
-
@snapshot_id = actual.body['snapshotId']
|
20
|
-
actual.body['snapshotId'].should be_a(String)
|
21
|
-
actual.body['startTime'].should be_a(Time)
|
22
|
-
actual.body['status'].should be_a(String)
|
23
|
-
actual.body['volumeId'].should be_a(String)
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
27
|
-
describe 'failure' do
|
28
|
-
|
29
|
-
it "should raise a BadRequest error if the volume does not exist" do
|
30
|
-
lambda {
|
31
|
-
AWS[:ec2].create_snapshot('vol-00000000')
|
32
|
-
}.should raise_error(Excon::Errors::BadRequest)
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
-
|
3
|
-
describe 'EC2.create_volume' do
|
4
|
-
describe 'success' do
|
5
|
-
|
6
|
-
after(:each) do
|
7
|
-
AWS[:ec2].delete_volume(@volume_id)
|
8
|
-
end
|
9
|
-
|
10
|
-
it "should return proper attributes" do
|
11
|
-
actual = AWS[:ec2].create_volume('us-east-1a', 1)
|
12
|
-
actual.body['availabilityZone'].should be_a(String)
|
13
|
-
actual.body['createTime'].should be_a(Time)
|
14
|
-
actual.body['requestId'].should be_a(String)
|
15
|
-
actual.body['size'].should == 1
|
16
|
-
actual.body['snapshotId'].should be_nil
|
17
|
-
actual.body['status'].should be_a(String)
|
18
|
-
actual.body['volumeId'].should be_a(String)
|
19
|
-
@volume_id = actual.body['volumeId']
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
-
|
3
|
-
describe 'EC2.delete_snapshot' do
|
4
|
-
describe 'success' do
|
5
|
-
|
6
|
-
before(:each) do
|
7
|
-
@volume_id = AWS[:ec2].create_volume('us-east-1a', 1).body['volumeId']
|
8
|
-
@snapshot_id = AWS[:ec2].create_snapshot(@volume_id).body['snapshotId']
|
9
|
-
end
|
10
|
-
|
11
|
-
after(:each) do
|
12
|
-
AWS[:ec2].delete_volume(@volume_id)
|
13
|
-
end
|
14
|
-
|
15
|
-
it "should return proper attributes" do
|
16
|
-
AWS[:ec2].snapshots.get(@snapshot_id).wait_for { ready? }
|
17
|
-
actual = AWS[:ec2].delete_snapshot(@snapshot_id)
|
18
|
-
unless actual.body.empty?
|
19
|
-
actual.body['requestId'].should be_a(String)
|
20
|
-
[false, true].should include(actual.body['return'])
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
25
|
-
describe 'failure' do
|
26
|
-
|
27
|
-
it "should raise a BadRequest error if snapshot does not exist" do
|
28
|
-
lambda {
|
29
|
-
AWS[:ec2].release_address('snap-00000000')
|
30
|
-
}.should raise_error(Excon::Errors::BadRequest)
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
-
|
3
|
-
describe 'EC2.create_volume' do
|
4
|
-
describe 'success' do
|
5
|
-
|
6
|
-
before(:each) do
|
7
|
-
@volume_id = AWS[:ec2].create_volume('us-east-1a', 1).body['volumeId']
|
8
|
-
end
|
9
|
-
|
10
|
-
it "should return proper attributes" do
|
11
|
-
actual = AWS[:ec2].delete_volume(@volume_id)
|
12
|
-
actual.body['requestId'].should be_a(String)
|
13
|
-
actual.body['return'].should == true
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
17
|
-
describe 'failure' do
|
18
|
-
|
19
|
-
it "should raise a BadRequest error if volume does not exist" do
|
20
|
-
lambda {
|
21
|
-
AWS[:ec2].delete_volume('vol-00000000')
|
22
|
-
}.should raise_error(Excon::Errors::BadRequest)
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
-
|
3
|
-
describe 'EC2.describe_addresses' do
|
4
|
-
describe 'success' do
|
5
|
-
|
6
|
-
before(:each) do
|
7
|
-
@public_ip = AWS[:ec2].allocate_address.body['publicIp']
|
8
|
-
end
|
9
|
-
|
10
|
-
after(:each) do
|
11
|
-
AWS[:ec2].release_address(@public_ip)
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should return proper attributes with no params" do
|
15
|
-
actual = AWS[:ec2].describe_addresses
|
16
|
-
actual.body['requestId'].should be_a(String)
|
17
|
-
item = actual.body['addressesSet'].select {|address| address['publicIp'] == @public_ip}
|
18
|
-
item.should_not be_nil
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should return proper attributes for specific ip" do
|
22
|
-
actual = AWS[:ec2].describe_addresses(@public_ip)
|
23
|
-
actual.body['requestId'].should be_a(String)
|
24
|
-
item = actual.body['addressesSet'].select {|address| address['publicIp'] == @public_ip}
|
25
|
-
item.should_not be_nil
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
describe 'failure' do
|
30
|
-
|
31
|
-
it "should raise a BadRequest error if ip does not exist" do
|
32
|
-
lambda {
|
33
|
-
AWS[:ec2].describe_addresses('127.0.0.1')
|
34
|
-
}.should raise_error(Excon::Errors::BadRequest)
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
-
|
3
|
-
describe 'EC2.describe_snapshots' do
|
4
|
-
describe 'success' do
|
5
|
-
|
6
|
-
before(:all) do
|
7
|
-
@volume_id = AWS[:ec2].create_volume('us-east-1a', 1).body['volumeId']
|
8
|
-
AWS[:ec2].volumes.get(@volume_id).wait_for { ready? }
|
9
|
-
@snapshot_id = AWS[:ec2].create_snapshot(@volume_id).body['snapshotId']
|
10
|
-
AWS[:ec2].snapshots.get(@snapshot_id).wait_for { ready? }
|
11
|
-
end
|
12
|
-
|
13
|
-
after(:all) do
|
14
|
-
AWS[:ec2].delete_volume(@volume_id)
|
15
|
-
AWS[:ec2].delete_snapshot(@snapshot_id)
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should return proper attributes with no params" do
|
19
|
-
actual = AWS[:ec2].describe_snapshots
|
20
|
-
actual.body['snapshotSet'].should be_an(Array)
|
21
|
-
snapshot = actual.body['snapshotSet'].select {|snapshot| snapshot['snapshotId'] == @snapshot_id}.first
|
22
|
-
snapshot['progress'].should be_a(String)
|
23
|
-
snapshot['snapshotId'].should be_a(String)
|
24
|
-
snapshot['startTime'].should be_a(Time)
|
25
|
-
snapshot['status'].should be_a(String)
|
26
|
-
snapshot['volumeId'].should be_a(String)
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should return proper attributes with params" do
|
30
|
-
actual = AWS[:ec2].describe_snapshots([@snapshot_id])
|
31
|
-
actual.body['snapshotSet'].should be_an(Array)
|
32
|
-
snapshot = actual.body['snapshotSet'].select {|snapshot| snapshot['snapshotId'] == @snapshot_id}.first
|
33
|
-
snapshot['progress'].should be_a(String)
|
34
|
-
snapshot['snapshotId'].should be_a(String)
|
35
|
-
snapshot['startTime'].should be_a(Time)
|
36
|
-
snapshot['status'].should be_a(String)
|
37
|
-
snapshot['volumeId'].should be_a(String)
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
describe 'failure' do
|
42
|
-
|
43
|
-
it "should raise a BadRequest error if the snapshot does not exist" do
|
44
|
-
lambda {
|
45
|
-
AWS[:ec2].describe_snapshots('snap-00000000')
|
46
|
-
}.should raise_error(Excon::Errors::BadRequest)
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
50
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
-
|
3
|
-
describe 'EC2.describe_volumes' do
|
4
|
-
describe 'success' do
|
5
|
-
|
6
|
-
before(:each) do
|
7
|
-
@volume_id = AWS[:ec2].create_volume('us-east-1a', 1).body['volumeId']
|
8
|
-
end
|
9
|
-
|
10
|
-
after(:each) do
|
11
|
-
AWS[:ec2].delete_volume(@volume_id)
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should return proper attributes with no params" do
|
15
|
-
actual = AWS[:ec2].describe_volumes
|
16
|
-
actual.body['requestId'].should be_a(String)
|
17
|
-
volume = actual.body['volumeSet'].select {|volume| volume['volumeId'] == @volume_id}.first
|
18
|
-
volume['availabilityZone'].should be_a(String)
|
19
|
-
volume['createTime'].should be_a(Time)
|
20
|
-
volume['size'].should == 1
|
21
|
-
volume['snapshotId'].should be_nil
|
22
|
-
volume['status'].should be_a(String)
|
23
|
-
volume['volumeId'].should == @volume_id
|
24
|
-
volume['attachmentSet'].should == []
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should return proper attributes for specific volume" do
|
28
|
-
actual = AWS[:ec2].describe_volumes(@volume_id)
|
29
|
-
actual.body['requestId'].should be_a(String)
|
30
|
-
volume = actual.body['volumeSet'].select {|volume| volume['volumeId'] == @volume_id}.first
|
31
|
-
volume['availabilityZone'].should be_a(String)
|
32
|
-
volume['createTime'].should be_a(Time)
|
33
|
-
volume['size'].should == 1
|
34
|
-
volume['snapshotId'].should be_nil
|
35
|
-
volume['status'].should be_a(String)
|
36
|
-
volume['volumeId'].should == @volume_id
|
37
|
-
volume['attachmentSet'].should == []
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
describe 'failure' do
|
42
|
-
|
43
|
-
it "should raise a BadRequest error if volume does not exist" do
|
44
|
-
lambda {
|
45
|
-
AWS[:ec2].describe_volumes('vol-00000000')
|
46
|
-
}.should raise_error(Excon::Errors::BadRequest)
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
50
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
-
|
3
|
-
describe 'EC2.detach_volume' do
|
4
|
-
describe 'success' do
|
5
|
-
|
6
|
-
before(:each) do
|
7
|
-
@instance_id = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1, {'Placement.AvailabilityZone' => 'us-east-1a'}).body['instancesSet'].first['instanceId']
|
8
|
-
@volume_id = AWS[:ec2].create_volume('us-east-1a', 1).body['volumeId']
|
9
|
-
AWS[:ec2].servers.get(@instance_id).wait_for { ready? }
|
10
|
-
AWS[:ec2].servers.get(@instance_id).wait_for { ready? }
|
11
|
-
AWS[:ec2].attach_volume(@instance_id, @volume_id, '/dev/sdh')
|
12
|
-
AWS[:ec2].volumes.get(@volume_id).wait_for { ready? }
|
13
|
-
end
|
14
|
-
|
15
|
-
after(:each) do
|
16
|
-
AWS[:ec2].volumes.get(@volume_id).wait_for { ready? }
|
17
|
-
AWS[:ec2].delete_volume(@volume_id)
|
18
|
-
AWS[:ec2].terminate_instances([@instance_id])
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should return proper attributes" do
|
22
|
-
actual = AWS[:ec2].detach_volume(@volume_id)
|
23
|
-
actual.body['attachTime'].should be_a(Time)
|
24
|
-
actual.body['device'].should be_a(String)
|
25
|
-
actual.body['instanceId'].should be_a(String)
|
26
|
-
actual.body['requestId'].should be_a(String)
|
27
|
-
actual.body['status'].should be_a(String)
|
28
|
-
actual.body['volumeId'].should be_a(String)
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
describe 'failure' do
|
33
|
-
|
34
|
-
it "should raise a BadRequest error if the volume does not exist" do
|
35
|
-
lambda {
|
36
|
-
AWS[:ec2].detach_volume('vol-00000000')
|
37
|
-
}.should raise_error(Excon::Errors::BadRequest)
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
-
|
3
|
-
describe 'EC2.disassociate_address' do
|
4
|
-
describe 'success' do
|
5
|
-
|
6
|
-
before(:each) do
|
7
|
-
@instance_id = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
|
8
|
-
@public_ip = AWS[:ec2].allocate_address.body['publicIp']
|
9
|
-
AWS[:ec2].servers.get(@instance_id).wait_for { ready? }
|
10
|
-
AWS[:ec2].associate_address(@instance_id, @public_ip)
|
11
|
-
end
|
12
|
-
|
13
|
-
after(:each) do
|
14
|
-
AWS[:ec2].release_address(@public_ip)
|
15
|
-
AWS[:ec2].terminate_instances([@instance_id])
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should return proper attributes" do
|
19
|
-
actual = AWS[:ec2].disassociate_address(@public_ip)
|
20
|
-
actual.body['requestId'].should be_a(String)
|
21
|
-
[false, true].should include(actual.body['return'])
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
25
|
-
|
26
|
-
describe 'failure' do
|
27
|
-
|
28
|
-
it "should raise a BadRequest error if the address does not exist" do
|
29
|
-
lambda {
|
30
|
-
AWS[:ec2].disassociate_address('127.0.0.1')
|
31
|
-
}.should raise_error(Excon::Errors::BadRequest)
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|