fog 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/fog.gemspec +13 -7
- data/lib/fog.rb +1 -1
- data/lib/fog/aws.rb +0 -4
- data/lib/fog/aws/parsers/ec2/get_console_output.rb +4 -2
- data/lib/fog/aws/requests/ec2/associate_address.rb +1 -1
- data/lib/fog/aws/requests/ec2/attach_volume.rb +2 -2
- data/lib/fog/aws/requests/ec2/authorize_security_group_ingress.rb +1 -1
- data/lib/fog/aws/requests/ec2/delete_security_group.rb +1 -1
- data/lib/fog/aws/requests/ec2/delete_snapshot.rb +1 -1
- data/lib/fog/aws/requests/ec2/delete_volume.rb +1 -1
- data/lib/fog/aws/requests/ec2/describe_addresses.rb +1 -1
- data/lib/fog/aws/requests/ec2/describe_instances.rb +2 -2
- data/lib/fog/aws/requests/ec2/describe_key_pairs.rb +1 -1
- data/lib/fog/aws/requests/ec2/describe_security_groups.rb +1 -1
- data/lib/fog/aws/requests/ec2/describe_snapshots.rb +1 -1
- data/lib/fog/aws/requests/ec2/describe_volumes.rb +1 -1
- data/lib/fog/aws/requests/ec2/detach_volume.rb +1 -1
- data/lib/fog/aws/requests/ec2/get_console_output.rb +2 -2
- data/lib/fog/aws/requests/ec2/reboot_instances.rb +1 -1
- data/lib/fog/aws/requests/ec2/revoke_security_group_ingress.rb +1 -1
- data/lib/fog/aws/requests/ec2/run_instances.rb +2 -1
- data/lib/fog/aws/requests/ec2/terminate_instances.rb +1 -1
- data/lib/fog/collection.rb +7 -3
- data/lib/fog/terremark/shared.rb +4 -2
- data/lib/fog/vcloud.rb +25 -3
- data/lib/fog/vcloud/collection.rb +66 -0
- data/lib/fog/vcloud/model.rb +49 -0
- data/lib/fog/vcloud/models/vdc.rb +36 -0
- data/lib/fog/vcloud/models/vdcs.rb +36 -0
- data/lib/fog/vcloud/parser.rb +4 -1
- data/lib/fog/vcloud/parsers/get_vdc.rb +26 -1
- data/lib/fog/vcloud/parsers/login.rb +2 -6
- data/lib/fog/vcloud/requests/get_organization.rb +1 -1
- data/lib/fog/vcloud/requests/get_vdc.rb +32 -1
- data/lib/fog/vcloud/terremark/ecloud.rb +2 -1
- data/lib/fog/vcloud/terremark/ecloud/models/vdc.rb +20 -0
- data/lib/fog/vcloud/terremark/ecloud/models/vdcs.rb +29 -0
- data/lib/fog/vcloud/terremark/ecloud/parsers/get_vdc.rb +3 -3
- data/lib/fog/vcloud/terremark/ecloud/requests/get_vdc.rb +1 -1
- data/lib/fog/vcloud/terremark/vcloud/requests/get_vdc.rb +1 -1
- data/spec/aws/models/ec2/snapshots_spec.rb +1 -1
- data/spec/shared_examples/servers_examples.rb +1 -1
- data/spec/vcloud/models/vdc_spec.rb +46 -0
- data/spec/vcloud/models/vdcs_spec.rb +1 -0
- data/spec/vcloud/requests/get_organization_spec.rb +2 -2
- data/spec/vcloud/requests/get_vdc_spec.rb +6 -3
- data/spec/vcloud/spec_helper.rb +44 -8
- data/spec/vcloud/terremark/ecloud/models/vdc_spec.rb +43 -0
- data/spec/vcloud/terremark/ecloud/models/vdcs_spec.rb +25 -0
- data/spec/vcloud/terremark/ecloud/requests/get_vdc_spec.rb +8 -8
- data/spec/vcloud/terremark/vcloud/requests/get_vdc_spec.rb +4 -4
- data/tests/aws/helper.rb +0 -8
- data/tests/aws/requests/ec2/address_tests.rb +3 -3
- data/tests/aws/requests/ec2/availability_zone_tests.rb +2 -2
- data/tests/aws/requests/ec2/instance_tests.rb +122 -0
- data/tests/aws/requests/ec2/key_pair_tests.rb +1 -1
- data/tests/aws/requests/ec2/region_tests.rb +2 -2
- data/tests/aws/requests/ec2/security_group_tests.rb +6 -6
- data/tests/aws/requests/ec2/snapshot_tests.rb +2 -2
- data/tests/aws/requests/ec2/volume_tests.rb +5 -5
- data/tests/helper.rb +19 -6
- data/tests/rackspace/requests/servers/list_images_detail_tests.rb +1 -1
- metadata +14 -8
- data/spec/aws/requests/ec2/describe_instances_spec.rb +0 -104
- data/spec/aws/requests/ec2/get_console_output_spec.rb +0 -35
- data/spec/aws/requests/ec2/reboot_instances_spec.rb +0 -30
- data/spec/aws/requests/ec2/run_instances_spec.rb +0 -48
- data/spec/aws/requests/ec2/terminate_instances_spec.rb +0 -35
@@ -48,7 +48,7 @@ Shindo.tests('AWS::EC2 | key pair requests', ['aws']) do
|
|
48
48
|
AWS[:ec2].create_key_pair(@key_pair.name)
|
49
49
|
end
|
50
50
|
|
51
|
-
tests("#describe_key_pair('not_a_key_name')").raises(Fog::AWS::EC2::
|
51
|
+
tests("#describe_key_pair('not_a_key_name')").raises(Fog::AWS::EC2::NotFound) do
|
52
52
|
AWS[:ec2].describe_key_pairs('not_a_key_name').body
|
53
53
|
end
|
54
54
|
|
@@ -22,8 +22,8 @@ Shindo.tests('AWS::EC2 | region requests', ['aws']) do
|
|
22
22
|
|
23
23
|
tests('failure') do
|
24
24
|
|
25
|
-
tests("#describe_regions('
|
26
|
-
AWS[:ec2].describe_regions('
|
25
|
+
tests("#describe_regions('us-east-2')").raises(Fog::AWS::EC2::Error) do
|
26
|
+
AWS[:ec2].describe_regions('us-east-2')
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -79,7 +79,7 @@ Shindo.tests('AWS::EC2 | security group requests', ['aws']) do
|
|
79
79
|
AWS[:ec2].create_security_group(@security_group.name, @security_group.description)
|
80
80
|
end
|
81
81
|
|
82
|
-
tests("#authorize_security_group_ingress({'FromPort' => 80, 'GroupName' => 'not_a_group_name', 'IpProtocol' => 'tcp', 'toPort' => 80})").raises(Fog::AWS::EC2::
|
82
|
+
tests("#authorize_security_group_ingress({'FromPort' => 80, 'GroupName' => 'not_a_group_name', 'IpProtocol' => 'tcp', 'toPort' => 80})").raises(Fog::AWS::EC2::NotFound) do
|
83
83
|
AWS[:ec2].authorize_security_group_ingress({
|
84
84
|
'FromPort' => 80,
|
85
85
|
'GroupName' => 'not_a_group_name',
|
@@ -88,7 +88,7 @@ Shindo.tests('AWS::EC2 | security group requests', ['aws']) do
|
|
88
88
|
})
|
89
89
|
end
|
90
90
|
|
91
|
-
tests("#authorize_security_group_ingress({'GroupName' => 'not_a_group_name', 'SourceSecurityGroupName' => 'not_a_group_name', 'SourceSecurityGroupOwnerId' => '#{@owner_id}'})").raises(Fog::AWS::EC2::
|
91
|
+
tests("#authorize_security_group_ingress({'GroupName' => 'not_a_group_name', 'SourceSecurityGroupName' => 'not_a_group_name', 'SourceSecurityGroupOwnerId' => '#{@owner_id}'})").raises(Fog::AWS::EC2::NotFound) do
|
92
92
|
AWS[:ec2].authorize_security_group_ingress({
|
93
93
|
'GroupName' => 'not_a_group_name',
|
94
94
|
'SourceSecurityGroupName' => 'not_a_group_name',
|
@@ -96,11 +96,11 @@ Shindo.tests('AWS::EC2 | security group requests', ['aws']) do
|
|
96
96
|
})
|
97
97
|
end
|
98
98
|
|
99
|
-
tests("#describe_security_group('not_a_group_name)").raises(Fog::AWS::EC2::
|
99
|
+
tests("#describe_security_group('not_a_group_name)").raises(Fog::AWS::EC2::NotFound) do
|
100
100
|
AWS[:ec2].describe_security_groups('not_a_group_name')
|
101
101
|
end
|
102
102
|
|
103
|
-
tests("#revoke_security_group_ingress({'FromPort' => 80, 'GroupName' => 'not_a_group_name', 'IpProtocol' => 'tcp', 'toPort' => 80})").raises(Fog::AWS::EC2::
|
103
|
+
tests("#revoke_security_group_ingress({'FromPort' => 80, 'GroupName' => 'not_a_group_name', 'IpProtocol' => 'tcp', 'toPort' => 80})").raises(Fog::AWS::EC2::NotFound) do
|
104
104
|
AWS[:ec2].revoke_security_group_ingress({
|
105
105
|
'FromPort' => 80,
|
106
106
|
'GroupName' => 'not_a_group_name',
|
@@ -109,7 +109,7 @@ Shindo.tests('AWS::EC2 | security group requests', ['aws']) do
|
|
109
109
|
})
|
110
110
|
end
|
111
111
|
|
112
|
-
tests("#revoke_security_group_ingress({'GroupName' => 'not_a_group_name', 'SourceSecurityGroupName' => 'not_a_group_name', 'SourceSecurityGroupOwnerId' => '#{@owner_id}'})").raises(Fog::AWS::EC2::
|
112
|
+
tests("#revoke_security_group_ingress({'GroupName' => 'not_a_group_name', 'SourceSecurityGroupName' => 'not_a_group_name', 'SourceSecurityGroupOwnerId' => '#{@owner_id}'})").raises(Fog::AWS::EC2::NotFound) do
|
113
113
|
AWS[:ec2].revoke_security_group_ingress({
|
114
114
|
'GroupName' => 'not_a_group_name',
|
115
115
|
'SourceSecurityGroupName' => 'not_a_group_name',
|
@@ -117,7 +117,7 @@ Shindo.tests('AWS::EC2 | security group requests', ['aws']) do
|
|
117
117
|
})
|
118
118
|
end
|
119
119
|
|
120
|
-
tests("#delete_security_group('not_a_group_name')").raises(Fog::AWS::EC2::
|
120
|
+
tests("#delete_security_group('not_a_group_name')").raises(Fog::AWS::EC2::NotFound) do
|
121
121
|
AWS[:ec2].delete_security_group('not_a_group_name')
|
122
122
|
end
|
123
123
|
|
@@ -45,11 +45,11 @@ Shindo.tests('AWS::EC2 | snapshot requests', ['aws']) do
|
|
45
45
|
end
|
46
46
|
tests ('failure') do
|
47
47
|
|
48
|
-
tests("#describe_snapshot('snap-00000000')").raises(Fog::AWS::EC2::
|
48
|
+
tests("#describe_snapshot('snap-00000000')").raises(Fog::AWS::EC2::NotFound) do
|
49
49
|
AWS[:ec2].describe_snapshots('snap-00000000')
|
50
50
|
end
|
51
51
|
|
52
|
-
tests("#delete_snapshot('snap-00000000')").raises(Fog::AWS::EC2::
|
52
|
+
tests("#delete_snapshot('snap-00000000')").raises(Fog::AWS::EC2::NotFound) do
|
53
53
|
AWS[:ec2].delete_snapshot('snap-00000000')
|
54
54
|
end
|
55
55
|
|
@@ -76,23 +76,23 @@ Shindo.tests('AWS::EC2 | volume requests', ['aws']) do
|
|
76
76
|
|
77
77
|
@volume = AWS[:ec2].volumes.create(:availability_zone => @server.availability_zone, :size => 1)
|
78
78
|
|
79
|
-
tests("#describe_volume('vol-00000000')").raises(Fog::AWS::EC2::
|
79
|
+
tests("#describe_volume('vol-00000000')").raises(Fog::AWS::EC2::NotFound) do
|
80
80
|
AWS[:ec2].describe_volumes('vol-00000000')
|
81
81
|
end
|
82
82
|
|
83
|
-
tests("#attach_volume('i-00000000', '#{@volume.identity}', '/dev/sdh')").raises(Fog::AWS::EC2::
|
83
|
+
tests("#attach_volume('i-00000000', '#{@volume.identity}', '/dev/sdh')").raises(Fog::AWS::EC2::NotFound) do
|
84
84
|
AWS[:ec2].attach_volume('i-00000000', @volume.identity, '/dev/sdh')
|
85
85
|
end
|
86
86
|
|
87
|
-
tests("#attach_volume('#{@server.identity}', 'vol-00000000', '/dev/sdh')").raises(Fog::AWS::EC2::
|
87
|
+
tests("#attach_volume('#{@server.identity}', 'vol-00000000', '/dev/sdh')").raises(Fog::AWS::EC2::NotFound) do
|
88
88
|
AWS[:ec2].attach_volume(@server.identity, 'vol-00000000', '/dev/sdh')
|
89
89
|
end
|
90
90
|
|
91
|
-
tests("#detach_volume('vol-00000000')").raises(Fog::AWS::EC2::
|
91
|
+
tests("#detach_volume('vol-00000000')").raises(Fog::AWS::EC2::NotFound) do
|
92
92
|
AWS[:ec2].detach_volume('vol-00000000')
|
93
93
|
end
|
94
94
|
|
95
|
-
tests("#delete_volume('vol-00000000')").raises(Fog::AWS::EC2::
|
95
|
+
tests("#delete_volume('vol-00000000')").raises(Fog::AWS::EC2::NotFound) do
|
96
96
|
AWS[:ec2].delete_volume('vol-00000000')
|
97
97
|
end
|
98
98
|
|
data/tests/helper.rb
CHANGED
@@ -5,6 +5,14 @@ if ENV["FOG_MOCK"] == "true"
|
|
5
5
|
Fog.mock!
|
6
6
|
end
|
7
7
|
|
8
|
+
# Boolean hax
|
9
|
+
module Fog
|
10
|
+
module Boolean
|
11
|
+
end
|
12
|
+
end
|
13
|
+
FalseClass.send(:include, Fog::Boolean)
|
14
|
+
TrueClass.send(:include, Fog::Boolean)
|
15
|
+
|
8
16
|
module Shindo
|
9
17
|
class Tests
|
10
18
|
|
@@ -38,21 +46,26 @@ module Shindo
|
|
38
46
|
case value
|
39
47
|
when Array
|
40
48
|
valid &&= datum.is_a?(Array)
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
49
|
+
if datum.is_a?(Array)
|
50
|
+
for element in datum
|
51
|
+
type = value.first
|
52
|
+
if type.is_a?(Hash)
|
53
|
+
valid &&= formats_kernel({:element => element}, {:element => type}, false)
|
54
|
+
else
|
55
|
+
valid &&= element.is_a?(type)
|
56
|
+
end
|
47
57
|
end
|
48
58
|
end
|
49
59
|
when Hash
|
50
60
|
valid &&= datum.is_a?(Hash)
|
51
61
|
valid &&= formats_kernel(datum, value, false)
|
52
62
|
else
|
63
|
+
p "#{key} => #{value}" unless datum.is_a?(value)
|
53
64
|
valid &&= datum.is_a?(value)
|
54
65
|
end
|
55
66
|
end
|
67
|
+
p data unless data.empty?
|
68
|
+
p format unless format.empty?
|
56
69
|
valid &&= data.empty? && format.empty?
|
57
70
|
if !valid && original
|
58
71
|
@message = "#{original_data.inspect} does not match #{original_format.inspect}"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Shindo.tests('Rackspace::Servers#list_images_detail', 'rackspace') do
|
2
2
|
tests('success') do
|
3
3
|
|
4
|
-
tests('#list_images_detail').formats({'images' => [Rackspace::Servers::Formats::IMAGE]})
|
4
|
+
tests('#list_images_detail').formats({'images' => [Rackspace::Servers::Formats::IMAGE]}) do
|
5
5
|
Rackspace[:servers].list_images_detail.body
|
6
6
|
end
|
7
7
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 5
|
9
|
+
version: 0.1.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- geemus (Wesley Beary)
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-05-
|
17
|
+
date: 2010-05-27 00:00:00 -07:00
|
18
18
|
default_executable: fog
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -432,6 +432,10 @@ files:
|
|
432
432
|
- lib/fog/terremark/vcloud.rb
|
433
433
|
- lib/fog/vcloud.rb
|
434
434
|
- lib/fog/vcloud/bin.rb
|
435
|
+
- lib/fog/vcloud/collection.rb
|
436
|
+
- lib/fog/vcloud/model.rb
|
437
|
+
- lib/fog/vcloud/models/vdc.rb
|
438
|
+
- lib/fog/vcloud/models/vdcs.rb
|
435
439
|
- lib/fog/vcloud/parser.rb
|
436
440
|
- lib/fog/vcloud/parsers/get_organization.rb
|
437
441
|
- lib/fog/vcloud/parsers/get_vdc.rb
|
@@ -443,6 +447,8 @@ files:
|
|
443
447
|
- lib/fog/vcloud/requests/login.rb
|
444
448
|
- lib/fog/vcloud/terremark/all.rb
|
445
449
|
- lib/fog/vcloud/terremark/ecloud.rb
|
450
|
+
- lib/fog/vcloud/terremark/ecloud/models/vdc.rb
|
451
|
+
- lib/fog/vcloud/terremark/ecloud/models/vdcs.rb
|
446
452
|
- lib/fog/vcloud/terremark/ecloud/parsers/get_vdc.rb
|
447
453
|
- lib/fog/vcloud/terremark/ecloud/requests/get_vdc.rb
|
448
454
|
- lib/fog/vcloud/terremark/ecloud/requests/login.rb
|
@@ -467,11 +473,6 @@ files:
|
|
467
473
|
- spec/aws/models/s3/file_spec.rb
|
468
474
|
- spec/aws/models/s3/files_spec.rb
|
469
475
|
- spec/aws/requests/ec2/describe_images_spec.rb
|
470
|
-
- spec/aws/requests/ec2/describe_instances_spec.rb
|
471
|
-
- spec/aws/requests/ec2/get_console_output_spec.rb
|
472
|
-
- spec/aws/requests/ec2/reboot_instances_spec.rb
|
473
|
-
- spec/aws/requests/ec2/run_instances_spec.rb
|
474
|
-
- spec/aws/requests/ec2/terminate_instances_spec.rb
|
475
476
|
- spec/aws/requests/s3/copy_object_spec.rb
|
476
477
|
- spec/aws/requests/s3/delete_bucket_spec.rb
|
477
478
|
- spec/aws/requests/s3/delete_object_spec.rb
|
@@ -516,11 +517,15 @@ files:
|
|
516
517
|
- spec/slicehost/models/servers_spec.rb
|
517
518
|
- spec/spec_helper.rb
|
518
519
|
- spec/vcloud/bin_spec.rb
|
520
|
+
- spec/vcloud/models/vdc_spec.rb
|
521
|
+
- spec/vcloud/models/vdcs_spec.rb
|
519
522
|
- spec/vcloud/requests/get_organization_spec.rb
|
520
523
|
- spec/vcloud/requests/get_vdc_spec.rb
|
521
524
|
- spec/vcloud/requests/get_versions_spec.rb
|
522
525
|
- spec/vcloud/requests/login_spec.rb
|
523
526
|
- spec/vcloud/spec_helper.rb
|
527
|
+
- spec/vcloud/terremark/ecloud/models/vdc_spec.rb
|
528
|
+
- spec/vcloud/terremark/ecloud/models/vdcs_spec.rb
|
524
529
|
- spec/vcloud/terremark/ecloud/requests/get_vdc_spec.rb
|
525
530
|
- spec/vcloud/terremark/ecloud/requests/login_spec.rb
|
526
531
|
- spec/vcloud/terremark/vcloud/requests/get_vdc_spec.rb
|
@@ -528,6 +533,7 @@ files:
|
|
528
533
|
- tests/aws/helper.rb
|
529
534
|
- tests/aws/requests/ec2/address_tests.rb
|
530
535
|
- tests/aws/requests/ec2/availability_zone_tests.rb
|
536
|
+
- tests/aws/requests/ec2/instance_tests.rb
|
531
537
|
- tests/aws/requests/ec2/key_pair_tests.rb
|
532
538
|
- tests/aws/requests/ec2/region_tests.rb
|
533
539
|
- tests/aws/requests/ec2/security_group_tests.rb
|
@@ -1,104 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
-
|
3
|
-
describe 'EC2.describe_instances' do
|
4
|
-
describe 'success' do
|
5
|
-
|
6
|
-
before(:all) do
|
7
|
-
run_instances = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1).body
|
8
|
-
@instance_id = run_instances['instancesSet'].first['instanceId']
|
9
|
-
@reservation_id = run_instances['reservationId']
|
10
|
-
Fog.wait_for { AWS[:ec2].servers.get(@instance_id) }
|
11
|
-
AWS[:ec2].servers.get(@instance_id).wait_for { ready? }
|
12
|
-
end
|
13
|
-
|
14
|
-
after(:all) do
|
15
|
-
AWS[:ec2].terminate_instances([@instance_id])
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should return proper attributes with no params" do
|
19
|
-
actual = AWS[:ec2].describe_instances
|
20
|
-
reservation = actual.body['reservationSet'].select {|reservation| reservation['reservationId'] == @reservation_id}.first
|
21
|
-
reservation['groupSet'].should be_an(Array)
|
22
|
-
reservation['groupSet'].first.should be_a(String)
|
23
|
-
reservation['ownerId'].should be_a(String)
|
24
|
-
reservation['reservationId'].should be_a(String)
|
25
|
-
instance = reservation['instancesSet'].select {|instance| instance['instanceId'] == @instance_id}.first
|
26
|
-
instance['amiLaunchIndex'].should be_an(Integer)
|
27
|
-
# instance['architecture'].should be_a(String)
|
28
|
-
instance['blockDeviceMapping'].should be_an(Array)
|
29
|
-
instance['dnsName'].should be_a(String)
|
30
|
-
instance['imageId'].should be_a(String)
|
31
|
-
instance['instanceId'].should be_a(String)
|
32
|
-
instance['instanceState'].should be_a(Hash)
|
33
|
-
instance['instanceState']['code'].should be_a(Integer)
|
34
|
-
instance['instanceState']['name'].should be_a(String)
|
35
|
-
instance['instanceType'].should be_a(String)
|
36
|
-
instance['ipAddress'].should be_a(String)
|
37
|
-
instance['kernelId'].should be_a(String)
|
38
|
-
instance['keyName'].should be_a(String) if instance['keyName']
|
39
|
-
instance['launchTime'].should be_a(Time)
|
40
|
-
instance['monitoring'].should be_a(Hash)
|
41
|
-
[true, false].should include(instance['monitoring']['state'])
|
42
|
-
instance['placement'].should be_a(Hash)
|
43
|
-
instance['placement']['availabilityZone'].should be_a(String)
|
44
|
-
instance['privateDnsName'].should be_a(String)
|
45
|
-
instance['privateIpAddress'].should be_a(String)
|
46
|
-
instance['productCodes'].should be_an(Array)
|
47
|
-
instance['productCodes'].first.should be_a(String) if instance['productCodes'].first
|
48
|
-
instance['ramdiskId'].should be_a(String)
|
49
|
-
if instance['reason']
|
50
|
-
instance['reason'].should be_a(String)
|
51
|
-
end
|
52
|
-
# instance['rootDeviceName'].should be_a(String)
|
53
|
-
instance['rootDeviceType'].should be_a(String)
|
54
|
-
end
|
55
|
-
|
56
|
-
it "should return proper attributes with params" do
|
57
|
-
actual = AWS[:ec2].describe_instances(@instance_id)
|
58
|
-
reservation = actual.body['reservationSet'].select {|reservation| reservation['reservationId'] == @reservation_id}.first
|
59
|
-
reservation['groupSet'].should be_an(Array)
|
60
|
-
reservation['groupSet'].first.should be_a(String)
|
61
|
-
reservation['ownerId'].should be_a(String)
|
62
|
-
reservation['reservationId'].should be_a(String)
|
63
|
-
instance = reservation['instancesSet'].select {|instance| instance['instanceId'] == @instance_id}.first
|
64
|
-
instance['amiLaunchIndex'].should be_an(Integer)
|
65
|
-
# instance['architecture'].should be_a(String)
|
66
|
-
instance['blockDeviceMapping'].should be_an(Array)
|
67
|
-
instance['dnsName'].should be_a(String)
|
68
|
-
instance['imageId'].should be_a(String)
|
69
|
-
instance['instanceId'].should be_a(String)
|
70
|
-
instance['instanceState'].should be_a(Hash)
|
71
|
-
instance['instanceState']['code'].should be_a(Integer)
|
72
|
-
instance['instanceState']['name'].should be_a(String)
|
73
|
-
instance['instanceType'].should be_a(String)
|
74
|
-
instance['ipAddress'].should be_a(String)
|
75
|
-
instance['kernelId'].should be_a(String)
|
76
|
-
instance['keyName'].should be_a(String) if instance['keyName']
|
77
|
-
instance['launchTime'].should be_a(Time)
|
78
|
-
instance['monitoring'].should be_a(Hash)
|
79
|
-
[true, false].should include(instance['monitoring']['state'])
|
80
|
-
instance['placement'].should be_a(Hash)
|
81
|
-
instance['placement']['availabilityZone'].should be_a(String)
|
82
|
-
instance['privateDnsName'].should be_a(String)
|
83
|
-
instance['privateIpAddress'].should be_a(String)
|
84
|
-
instance['productCodes'].should be_an(Array)
|
85
|
-
instance['productCodes'].first.should be_a(String) if instance['productCodes'].first
|
86
|
-
instance['ramdiskId'].should be_a(String)
|
87
|
-
if instance['reason']
|
88
|
-
instance['reason'].should be_a(String)
|
89
|
-
end
|
90
|
-
# instance['rootDeviceName'].should be_a(String)
|
91
|
-
instance['rootDeviceType'].should be_a(String)
|
92
|
-
end
|
93
|
-
|
94
|
-
end
|
95
|
-
describe 'failure' do
|
96
|
-
|
97
|
-
it 'should raise a Fog::AWS::EC2::Error if the instance does not exist' do
|
98
|
-
lambda {
|
99
|
-
AWS[:ec2].describe_instances('i-00000000')
|
100
|
-
}.should raise_error(Fog::AWS::EC2::Error)
|
101
|
-
end
|
102
|
-
|
103
|
-
end
|
104
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
-
|
3
|
-
describe 'EC2.get_console_output' do
|
4
|
-
describe 'success' do
|
5
|
-
|
6
|
-
before(:each) do
|
7
|
-
@instance = AWS[:ec2].servers.create(:image_id => GENTOO_AMI)
|
8
|
-
@instance.wait_for { ready? }
|
9
|
-
end
|
10
|
-
|
11
|
-
after(:each) do
|
12
|
-
@instance.destroy
|
13
|
-
end
|
14
|
-
|
15
|
-
it "should return proper attributes" do
|
16
|
-
actual = AWS[:ec2].get_console_output(@instance.id).body
|
17
|
-
actual['instanceId'].should be_a(String)
|
18
|
-
if actual['output']
|
19
|
-
actual['output'].should be_a(String)
|
20
|
-
end
|
21
|
-
actual['requestId'].should be_a(String)
|
22
|
-
actual['timestamp'].should be_a(Time)
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
describe 'failure' do
|
27
|
-
|
28
|
-
it "should raise a Fog::AWS::EC2::Error if the instance does not exist" do
|
29
|
-
lambda {
|
30
|
-
AWS[:ec2].get_console_output('i-00000000')
|
31
|
-
}.should raise_error(Fog::AWS::EC2::Error)
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
35
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
-
|
3
|
-
describe 'EC2.reboot_instances' 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
|
-
end
|
9
|
-
|
10
|
-
after(:each) do
|
11
|
-
AWS[:ec2].terminate_instances(@instance_id)
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should return proper attributes" do
|
15
|
-
actual = AWS[:ec2].reboot_instances(@instance_id)
|
16
|
-
actual.body['requestId'].should be_a(String)
|
17
|
-
[false, true].should include(actual.body['return'])
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
describe 'failure' do
|
22
|
-
|
23
|
-
it "should raise a Fog::AWS::EC2::Error if the instance does not exist" do
|
24
|
-
lambda {
|
25
|
-
AWS[:ec2].reboot_instances('i-00000000')
|
26
|
-
}.should raise_error(Fog::AWS::EC2::Error)
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
30
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
-
|
3
|
-
describe 'EC2.run_instances' do
|
4
|
-
describe 'success' do
|
5
|
-
|
6
|
-
after(:each) do
|
7
|
-
AWS[:ec2].terminate_instances(@instance_id)
|
8
|
-
end
|
9
|
-
|
10
|
-
it "should return proper attributes" do
|
11
|
-
# ami-5ee70037 = gentoo
|
12
|
-
actual = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1)
|
13
|
-
@instance_id = actual.body['instancesSet'].first['instanceId']
|
14
|
-
actual.body['groupSet'].should be_an(Array)
|
15
|
-
actual.body['groupSet'].first.should be_a(String)
|
16
|
-
actual.body['instancesSet'].should be_an(Array)
|
17
|
-
instance = actual.body['instancesSet'].first
|
18
|
-
instance['amiLaunchIndex'].should be_a(Integer)
|
19
|
-
# instance['architecture'].should be_a(String)
|
20
|
-
instance['blockDeviceMapping'].should be_an(Array)
|
21
|
-
instance['dnsName'].should be_nil
|
22
|
-
instance['imageId'].should be_a(String)
|
23
|
-
instance['instanceId'].should be_a(String)
|
24
|
-
instance['instanceState'].should be_an(Hash)
|
25
|
-
instance['instanceState']['code'].should be_an(Integer)
|
26
|
-
instance['instanceState']['name'].should be_an(String)
|
27
|
-
instance['instanceType'].should be_a(String)
|
28
|
-
# instance['ipAddress'].should be_a(String)
|
29
|
-
instance['kernelId'].should be_a(String)
|
30
|
-
instance['keyName'].should be_a(String) if instance['keyName']
|
31
|
-
instance['launchTime'].should be_a(Time)
|
32
|
-
instance['monitoring'].should be_a(Hash)
|
33
|
-
[false, true].should include(instance['monitoring']['state'])
|
34
|
-
instance['placement'].should be_a(Hash)
|
35
|
-
instance['placement']['availabilityZone'].should be_a(String)
|
36
|
-
instance['privateDnsName'].should be_nil
|
37
|
-
# instance['privateIpAddress'].should be_a(String)
|
38
|
-
instance['ramdiskId'].should be_a(String)
|
39
|
-
instance['reason'].should be_nil
|
40
|
-
actual.body['ownerId'].should be_a(String)
|
41
|
-
actual.body['requestId'].should be_a(String)
|
42
|
-
actual.body['reservationId'].should be_a(String)
|
43
|
-
# instance['rootDeviceName'].should be_a(String)
|
44
|
-
instance['rootDeviceType'].should be_a(String)
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
48
|
-
end
|